Solution for Exercise 8-5
ex0805
#include <stdio.h>
int main()
{
int first,second;
printf("Input the first value: ");
scanf("%d",&first);
printf("Input the second value: ");
scanf("%d",&second);
puts("Evaluating...");
if(first<second)
{
printf("%d is less than %d\n",first,second);
}
if(first>second)
{
printf("%d is greater than %d\n",first,second);
}
if(first==second)
{
printf("%d is equal to %d\n",first,second);
}
return(0);
}
Output
Input the first value: -7
Input the second value: -7
Evaluating...
-7 is equal to -7
Notes
* Two equal signs are used for comparison.
* When you see ==, say "is equal to."
* You do not use == to compare strings.
Copyright © 1997-2025 by QPBC.
All rights reserved
