Monday, December 10, 2007

How to compare number in C++ using If nested loop

How to compare number in C++ using If nested loop

To compare number in C++ using If nested loop

#include

int first, second;

int main()

{ printf("\nInput an integer value for 1st number : ");

scanf("%d", &first);

printf("\nInput an integer value for 2nd number : ");

scanf("%d", &second);

if (first == second)

printf("first number is equal to second number\n");

if (first > second)

printf("first number is greater than second number\n");

if (first <>

printf("first number is smaller than second number\n");

return 0;

}

Result :

No comments: