Monday, June 18, 2012

To relate two integers using the = or > or < sign


/* Program to relate two integers using the = or > or < sign */

#include<stdio.h>

#include<conio.h>

void main()

{

  int num1,num2;

  clrscr();

  printf("Enter any two numbers:");

  scanf("%d%d",&num1,&num2);

  /* Checking for equality */

  if(num1==num2)

    printf("\nResult:%d=%d",num1,num2);

  /* Checking for inequality */

  else if(num1>num2)

    printf("\nResult:%d>%d",num1,num2);

  else

   printf("\nResult:%d<%d",num1,num2);

  getch();

}

 

OUTPUT

Enter any two numbers:18

81

 

Result:18<81

 

No comments:

Post a Comment

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