Pages

write a program to get 4 numbers from user and print greater number using IF statement.

Friday 19 April 2013


#include<stdio.h>
#include<conio.h>

int main()
{
    int a,b,c,d;
    printf(" value of a,b,c,d from user\n");
    printf("enter the a value\n");
    scanf("%d",&a);
      printf("enter the b value\n");
    scanf("%d",&b);
      printf("enter the c value\n");
    scanf("%d",&c);
      printf("enter the d value\n");
    scanf("%d",&d);
    printf("\t*********greater number is ********\n");
    if(a>b)
    if(a>c) 
    if(a>d){
                  printf("   a is greater \n");
                  }
                                         
                        if(b>a) 
                         if(b>c)
                           if(b>d){
                               printf("b is greater \n");}
                             
                                   if(c>a) 
                                    if(c>b)  
                                    if(c>d){
                                          printf("c is greater \n");}
                                              if(d>a)
                                                 if(d>b)
                                                  if (d>c)
                                               {
                                                      printf("  d is greater ");}                         
                  getch();
    
}

 

Search Box

Most Reading

Contact Form

Name

Email *

Message *