Biggest of 2 Numbers in C

This Biggest of 2 Numbers in C program explains clearly in how many ways we can find Biggest of two numbers using C language Syntax.


#include<stdio.h>
void main()
{
int a,b ;
printf(“Enter 2 integers : “);
scanf(“%d%d”, &a , &b);
if(a>b)
printf(“a : %d is big \n”,a);
else
printf(“b : %d is big \n”,b);
}


Biggest of 2 numbers using conditional operator :
#include<stdio.h>
void main()
{
int a,b ;
printf(“Enter 2 integers : “);
scanf(“%d%d”, &a , &b);
a>b ? printf(“a is big”) : printf(“b is big”);
}


#include<stdio.h>
void main()
{
int a,b,big;
printf(“Enter 2 integers : “);
scanf(“%d%d”, &a , &b);
big = a>b ? a : b;
printf(“Big one is : %d”, big);
}


 

Share this