Answer to Question #44891 in C for erico fire

Question #44891
write a c program that accepts a numbers from the user and display whether the number inputted is an even or odd number?
1
Expert's answer
2014-08-13T11:09:23-0400
#include <stdio.h>
#include <stdlib.h>
//main function
int main(){

int number;
//prompt user to enter number
printf("Enter number: ");
//read number
scanf("%d",&number);
//display whether the number inputted is an even or odd number
if((number%2)==0){
printf("The number inputted is an even number\n");
}else{
printf("The number inputted is an odd number\n");
}
system("PAUSE");//delay
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS