#include⁢stdio.h> main() { int a,b,m; printf("Enter 2 different Nos. ") ; scanf("%d %d",&a,&b); m=a>b?a:b; printf("Greatest number is %d",m); }
Enter 2 different Nos. 8 7 Greatest number is 8
#include⁢stdio.h> main() { int a,b,c,d,z,x,y; printf("Enter 4 diff nos "); scanf("%d %d %d %d",&a,&b,&c,&d); x=a>b?a:b; y=c>d?c:d; z=x>y?x:y; printf("%d is Greatest ",z); }
Enter 4 different Nos. 8 7 9 6 Greatest number is 9
#include⁢stdio.h> main() { int units,Rate,ExtraChanges,BillAmt; printf("Enter Electricity Units "); scanf("%d",&units); Rate=units>=300?5:3; ExtraChanges=units>=1000? 500:0; BillAmt=units*Rate+ExtraChanges; printf("BillAmt is %d",BillAmt); }
Enter Electricity Units 25 BillAmt is 75