Design a program to find largest of four numbers

November 14, 2014 0 Comments

The logic behind the program is, Take four variable like a, b, c, d for numbers also take another variable like large for comparing among three numbers. First of all, assign the value of variable a into the large variable. Compare among three numbers with the large variable. If any one is find larger then you have to assign this variable value into the larger variable.

Example

#include <stdio.h>
#include<conio.h>
main()
{
int a,b,c,d;
int large;

clrscr();
printf("Enter four numbers:\n");
scanf("%d%d%d%d",&a,&b,&c,&d);
large=a;
if(b>large)
large=b;
if(c>large)
large=c;
if(d>large)
large=d;
printf("The largest number is %d",large);
}

Output Of the Given program is

Jacob Lefore

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard. Google

0 comments: