|
CS256 - Principles of Structured Design
Fall 2021
|
Displaying ./code/sternflCode/h3/oddEven.c
/*
oddEven.c - find whether the given number is odd or even
Hint: You'll want to use a modulus statement here. Numbers that are even are
divisible by 2, so if you take any even number mod 2, you'll get 0.
*/
#include <stdio.h>
int main(){
int num; //variable declaration
printf("Please enter a number> "); //ask the user for a number
scanf("%d", &num);//use scanf to get that number
//then use an if statement to determine what we tell the user
//if the number is even, tell the user it's even
//if not, tell the user that it's odd
return 0;
}
|