Skip to main content

Largest of three numbers

#include <stdio.h> int main() { int a, b, c, largest; printf ("Enter three numbers : "); scanf ("%d%d%d", &a, &b, &c); largest = a; // Let 'a' be the largest number
if(b > largest) largest = b; if(c > largest) largest = c; printf ("\n%d is the largest number.", largest); // To find the smallest number, replace '>' with '<' return 0; }



Enter three numbers :  52 98 64

98 is the largest number.

Comments