The pseudo code would be as follows (you figure out the syntax)
1) Prompt the user to enter a number
2) If entered number is alpha, quit program after displaying message that the user ended the program.
3) Otherwise, find Modulo 2 of the entered number. This is a fancy way of saying "find the remainder when the number is divided by 2)
4) If Modulo 2 is zero, the number is even, otherwise odd
5) Display message showing if the entered number was Even or Odd
6) Branch back to step 1
for(int i = 1; i < 100; i+=2) { System.out.println(i); }
No, thanks.
You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.
int main () { int x; printf ("Enter the value of x\n"); scanf ("%d",&x); if (0 == x%2) printf ("Number is even\n") else printf ("Number is odd\n"); }
int i, sum = 0; for (i=0; i<20; i+=2) sum+=i;
for(int i = 1; i < 100; i+=2) { System.out.println(i); }
To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.
if n MOD 2 == 0 THEN Write ("Even");
No, thanks.
echo "Program to check even or odd number"echo "Enter a number"read na=`expr $n % 2`if [ $a -eq 0 ] ; then #Semicolon is most important for Executing ifelse statementsecho "It is an even number"elseecho "It is an odd number"fi
echo "Enter the Number" read n r=`expr $n % 2` if [ $r -eq 0 ] then echo "$n is Even number" else echo "$n is Odd number" fi
Shell problems are programs that can be run to find out information about numbers. The problem can help find an even or odd number, or what the sum of a cube is.
You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.
int main () { int x; printf ("Enter the value of x\n"); scanf ("%d",&x); if (0 == x%2) printf ("Number is even\n") else printf ("Number is odd\n"); }
Solution 1: echo 2 4 6 8 10 Solution 2: seq 2 2 100
doo doo
write a program in C that prompts the user with the following lines: a) Add two integers c) Compare two integers for the larger t) Test an integers for odd or even q) Quit