To find the largest of three numbers you must first find the largest of two numbers:
int max (int a, int b) { return a>b?a:b; // or, equivalently: if (a>b) return a; else return b;
}
Now we can use this function to find the maximum of three:
int max3 (int a, int b, int c) {
return max (max (a,b), c);
}
Chat with our AI personalities
int i, largest=0;do { scanf ("Enter a number (0 to exit): %d", i); if (i>largest) largest=i; } while (i!=0); printf ("Largest number is: %d\n", largest);
Computer Programming is all about algebra. In algebra, you solve for variables like x and y in their simplest form, in programming, the variables can pass on values or accept values and give you the result.For eg:Find the area of a square with side 'a' units.In algebra: Area=a2.In Programming, the program can find the area by taking input from the user.float area,a;couta;area=a*a;cout
The best ones find work, and the rest don't.
start input A & B if A>B print A is greatest if B>A print B is greatest stop james ola writes.....SOT.
I need to find a programming manual for a Sanyo ERC 340 cash register.