LOGIC 1 (Conditional Operator)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
int a,b,c; | |
printf("Enter the 1st number: "); | |
scanf("%d",&a); | |
printf("Enter the 2nd number: "); | |
scanf("%d",&b); | |
c=a>b?a:b; | |
printf("The largest number is %d",c); | |
getch(); | |
return(0); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
int a,b,c; | |
printf("Enter the 1st number: "); | |
scanf("%d",&a); | |
printf("Enter the 2nd number: "); | |
scanf("%d",&b); | |
if(a>b) | |
printf("The largest number is %d",a); | |
else | |
printf("The largest number is %d",b); | |
getch(); | |
return(0); | |
} |
Comments
Post a Comment