Wednesday, 10 September 2014

Biggest of two numbers in C program

Find the Biggest of two numbers. This sample  & simple program discuss about finding largest value from the given few numbers by the C source code. It is a simple source program to understand easily. It can be used in all LAB exams and theory exams also. It is an useful C program for beginners.

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();
}

No comments:

Post a Comment

Note: only a member of this blog may post a comment.