I need to do this assignment with these in the progam:
Read a number
Print the number back to the user
If the number is negative, program should quit. Assume positive integer values for all other questions
The number before
The number after
Is Even or Odd
what I have so far is
#include %26lt;stdio.h%26gt;
int main()
{
int num;
printf("Enter your number: ");
scanf("%d", %26amp;num);
printf("Your number is %d\n", num);
return 0
}
I seem to have the first 2 done but i run into trouble with the rest of them... can someone help me with this
C progamming?
if (num %26lt; 1) {
return 0;
}
printf ("Number before is %d and the number after is %d\n", num-1, num+1);
if(num % 2) {
printf ("Your number is odd\n");
} else {
printf ("Your number is even\n");
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment