
BIGGEST OF TWO VALUES IN C
Biggest of two numbers in c is used to find the biggest number of a given 2 values by using conditional statement of if…else statements. It will check which number is great by first condition. In if statement as(value1>value2) it true value1 is greater else value2 is greater.
//Header files
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr(); //This function is used to clear previous output
//Program variable
float value1,value2;
printf("\n\n FIND THE GREATEST OF TWO NUMBERS"); /Display function
printf("\n\n ENTER THE TWO VALUE TO COMPARE");
scanf("%f%f",&value1,&value2); //Getting input value function
if(value1>value2) //if…else.. Statement (OR) conditional statement
{
printf("Big value Is %f",value1);
}
else
{
printf("Big value Is %f",value2);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr(); //This function is used to clear previous output
//Program variable
float value1,value2;
printf("\n\n FIND THE GREATEST OF TWO NUMBERS"); /Display function
printf("\n\n ENTER THE TWO VALUE TO COMPARE");
scanf("%f%f",&value1,&value2); //Getting input value function
if(value1>value2) //if…else.. Statement (OR) conditional statement
{
printf("Big value Is %f",value1);
}
else
{
printf("Big value Is %f",value2);
}
getch();
}
No comments:
Post a comment
Note: only a member of this blog may post a comment.