C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

C program to find the greatest of three numbers.

+2 votes
2,331 views
asked by Smita Advisor (7,140 points)

2 Answers

+1 vote
Program:
#include <stdio.h>
int main()
{
 int a, b, c;
 printf("Enter a,b,c: \n");
 scanf("%d %d %d", &a, &b, &c);

 if (a > b && a > c)
{
 printf("a is Greater than b and c");
 }
 else if (b > a && b > c)
{
 printf("b is Greater than a and c");
 }
 else if (c > a && c > b)
{
 printf("c is Greater than a and b");
 }
 else
{
 printf("all are equal or any two values are equal");
 }
 return 0;
}


Output:
Enter a,b,c: 3 5 8
c is Greater than a and b
answered by sagar Expert (12,340 points)
0 votes

 

#include<stdio.h>
main()
{
int a,b,c;
printf("\n Input the three numbers :");
scanf("%d%d%d",&a,&b,&c);
if(a>b)
{
if(a>c)
{
printf("\n Maximum= %d\n",a);
}
else
{
printf("Maximum= %d\n",c);
}
}
else if(b>c)
printf("\n Maximum= %d\n",b);
else
printf("\n Maximum= %d\n",c);
}
answered by Alokesh Ghosh Sr Member (1,180 points)

Related questions

0 votes
2 answers 68 views
+1 vote
2 answers 3,181 views
+1 vote
2 answers 4,253 views
0 votes
1 answer 195 views
+2 votes
2 answers 8,262 views
8,262 views asked by Smita Advisor (7,140 points)
...