Pages

Greatest numbers

1.How to find greatest numbers from three numbers.

#include<stdio.h>
#include<conio.h>

Void main()
{
                int a,b,c;
                clrscr();
                printf(“Enter the value of a \n”);
               scanf(“%d”,&a);
                printf(“Enter the value of b \n”);
               scanf(“%d”,&b);
printf(“Enter the value of c \n”);
               scanf(“%d”,&c);
                if(a>b && a>c)
                {
                printf(“a is greatest number”);
}
else if(b>a && b>c)
                {
                printf(“b  is greatest number”);
}else
{
                Printf(“c is greatest number”);
}
getch();
}

Output : 
Enter the value of a:
5
Enter the value of b:
7
Enter the value of c:
9
c is greatest number

No comments:

Post a Comment