Friday 26 July 2013

Chapter 2 solutions Problem [J][c]

Question-Write a program to find the greatest of the three numbers
entered through the keyboard using conditional operators.
Solution- well, this is going to be the last question of this chapter, since previous 2 question are simply repeated.Here is the solution.

#include<stdio.h>
int main()
{
int a,b,c;
printf("Enter any three numbers\n");
scanf("%d%d%d",&a,&b,&c);
if(a>b&&a>c)
printf("1st number is biggest\n");
if(b>a&&b>c)
printf("Second number is biggest\n");
if(c>a&&c>b)
printf("Third number is biggest\n");
return 0;
}

No comments:

Post a Comment