Friday, February 27, 2015

5. Write all the programs into four integers. Find and print the largest number. int main () {int a


4. Write a program all in positive integers x. in the announcement of an even or odd number. int main () {int x; printf ("Enter in x:"); scanf ("% d", & x); if (x% 2 == 0) printf ("x is the number of chan"); else printf ("x is odd"); return lapolicegear 0; }
5. Write all the programs into four integers. Find and print the largest number. int main () {int a, b, c, d, max1, MAX2, max; printf lapolicegear ("Click 4 integers a, b, c, d: \ n"); scanf ("% d% d% d% d", lapolicegear & a, & b, & c, & d); if (a> b) max1 = a; else max1 = b; if (c> d) MAX2 = c; else MAX2 = d; if (max1> MAX2) max = max1; max = MAX2 else; printf lapolicegear ("the largest positive integer:% d", max); return 0; }
6. Write a program to solve all quadratic lapolicegear equation 2 + bx + c = AX2 0, with a, b, c input from the keyboard. int main () {float a, b, c, Delta, x1, x2; printf ("Enter in the three variables lapolicegear a, b, c: \ n"); scanf ("% d% d% d", & a, & b, & c); Delta = (b * b) - (4 * a * c); if (Delta <0) {printf ("equation lapolicegear vo nghiem"); return 0; } If (Delta == 0) x1 = x2 = -b / (2 * a); else {x1 = (- b-sqrt (Delta)) / (2 * a); x2 = (- b + sqrt (Delta)) / (2 * a); } Printf ("x1 =%. 2f \ n", x1); printf ("x2 =%. 2f", x2); return 0; }
Last 7. Write a program in hours, minutes, seconds (hh: mm: ss). Plus the number of seconds in and print out the results in the form hh: mm: ss int main () {int hh, mm, ss, t; printf ("Enter in hours, minutes, seconds: \ n"); scanf ("% d% d% d", & hh, and mm, and ss); printf ("Click Shine added: \ n"); scanf ("% d", & t); if (ss + t <60) {ss = ss + t; } Else {ss = (ss + t) -60; mm mm + = 1; } If (mm> = 60) {mm = mm - 60; hh hh = +1; } Printf ("\ ngio: minutes: seconds:% .2d:%. 2d:%. 2d", hh, mm, ss); return 0; }
You are commenting using của Google+ account. (Log Out / Change)
% D bloggers like this:

No comments:

Post a Comment