|
CS256 - Principles of Structured Design
Fall 2021
|
Displaying ./code/h5sol/printBigger.c
/*
printBigger.c
You will get two numbers from the user, then print whichever number is bigger.
Just print that number, and then a newline to the terminal.
*/
#include <stdio.h>
int main(){
int a, b; // declaring two int variables
//use printf ask the user for a number
//then use scanf to get the number from the user and store it in the variable
printf("Enter a number: ");
scanf("%d", &a); //
//repeat the above step once more for the other variable
printf("Enter another number: ");
scanf("%d", &b);
/*
then use an if-else statement to determine which number to print. we
want to print which number is bigger.
Also, dont forget to include a newline character "\n" at the end of your
string.
*/
if(a > b)
printf("%d\n", a);
else
printf("%d\n", b);
return 0;
}
|