Wednesday, 30 September 2015

C Program to find the smallest number using if statement logical operator

C Program to find the smallest number using if statement logical operator


/*C Program to find the smallest number using if statement logical operator*/
#include<stdio.h>
main()
{
      int num1,num2,num3;
      printf("Enter Number1  ");
      scanf("%d",&num1);
      printf("Enter Number2  ");
      scanf("%d",&num2);
      printf("Enter Number3  ");
      scanf("%d",&num3);
      if(num1<num2&&num1<num3)
      {
           printf("\n The smallest number is %d",num1);
      }
      else if(num2<num3&&num2<num1)
      {
           printf("\n The smallest number is %d",num2);
      }
      else
      {
           printf("\n The smallest number is %d",num3);
      }
}

No comments:

Post a Comment