Solution for Exercise 8-13
ex0813
#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); } else if(first>second) { printf("%d is greater than %d\n",first,second); } else { printf("%d is equal to %d\n",first,second); } return(0); }
Notes
* The condition remaining for the final else part of the structure is ==
(is equal to). That's expressed by the printf() statement at Line 23. You could specify that condition with another else if, but it's not necessary.
Copyright © 1997-2024 by QPBC.
All rights reserved