Practice Program
Solution:
void main()
{ //maximum among two numbers.
int a,b,max;
printf("Enter the firsts number: ");
scanf("%d",&a);
printf("\nEnter the second number: ");
scanf("%d",&b);
if(a>b)
max = a;
else
max = b;
printf("\nMaximum value is %d",max);
}
void main() { //maximum among two numbers. int a,b,max; printf("Enter the firsts number: "); scanf("%d",&a); printf("\nEnter the second number: "); scanf("%d",&b); if(a>b) max = a; else max = b; printf("\nMaximum value is %d",max); }
Output1
Enter the firsts number:10
Enter the second number: 20
Maximum value is 20.
Enter the second number: 20
Maximum value is 20.
Output2
Enter the firsts number:20
Enter the second number:30
Maximum value is 30.
Enter the second number:30
Maximum value is 30.
Output3
Enter the firsts number:40
Enter the second number:50
Maximum value is 50.
Enter the second number:50
Maximum value is 50.
0 Comments
Post a Comment