Tuesday, December 30, 2014

C program to find largest number using if...else statement

/* C program to find largest number using if...else statement */


#include <stdio.h>
#include<conio.h>
void main()
{
int a, b, c;
printf("Enter the values of a, b and c: ");
scanf("%d%d%d", &a, &b, &c);
if (a>b && a>c)
{
printf("A is largest number = %d",a);
}
if (b>a && b>c)
{
printf("B is largest number = %d",b);
}
if (c>a && c>b)
{
printf("C is largest number = %d",c);
}
getch();
}
                  OR
#include <stdio.h>
#include <conio.h>
int main()
{
int a, b, c;
printf("Enter a,b,c: ");
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");
}
getch();
}

1 comment:

  1. Bonus Slots | Play Slots at Casino Roll
    Welcome 코드 벳 to Casino Roll! 바카라 양방 At Casino Roll! Our award-winning slots and casino games floor, we offer you the chance betmove to 토토 사이트 제작 experience the 벳 매니아 most thrilling gaming

    ReplyDelete