Friday, March 28, 2014

Get three numbers from users and make decision using single if statements if all three numbers are equal print all numbers are equal otherwise print the largest number entered by the user

#include<stdio.h>
#include<stdlib.h>
void line()
{
int i,j;
printf("\n");
for(i=1;i<=42;i++)
printf("=");
}
void header()
{
printf("\n");
printf("Built and Designed by Arslan Malik\n\n www.CworldbyAS.blogspot.com");
printf("\n");
}
int main()
{
line();
header();
line();
int a,b,c;
printf("\nEnter Three Integers : ");
scanf("%d%d%d",&a,&b,&c);


    if (a==b==c)
        printf("All integers are euqal.\n");
    if(a>b && a>c)
        printf("Largest integer is : %d \n",a);
    if(b>a && b>c)
        printf("Largest Number is : %d \n",b);
    if(c>a && c>b)
        printf("Largest number is : %d \n",c);
return 0;
}

No comments:

Post a Comment