C Practice Problems For Beginners-9
Problem Statement:-Write a C program to find the largest element of all the 3 no's
Code:-
#include <stdio.h>
void main(){
int a,b,c;
printf("enter 3 no's :- ");
scanf("%d%d%d",&a,&b,&c);
if(a==b || b==c || c==a){
if(a==b && b!=c)
{
printf("a & b same %d%d",a,b);
}
else if(a!=b && b==c){
printf("c & b same %d%d",c,b);
}
else if(a==b && b==c){
printf("all are same");
}
printf("\ninvalid no:");
}
else{
if(a>b && a>c){
printf("a is largest %d ",a);
}
else if(b>a && b>c){
printf("b is largest %d",b);
}
else{
printf("c is largest %d",c);
}
}
}
Output:-
0 Comments