for(int i = 1; i < 100; i+=2) { System.out.println(i); }
No, thanks.
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"); }
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
In BASIC: 10 INPUT X: IF X = 999 THEN STOP ELSE PRINT X; 20 IF X/2 = INT(X/2) THEN PRINT "EVEN" ELSE PRINT "ODD" 30 GOTO 10
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.
for(int i = 1; i < 100; i+=2) { System.out.println(i); }
if n MOD 2 == 0 THEN Write ("Even");
No, thanks.
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"); }
If the number is odd, that's the answer. If the number is even, write down all the factors and choose the largest one that is odd.
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
printf ("%d is %s\n", n, n%2 ? "odd": "even");
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
printf(\n "ENTER THE NUMBER\t"); scanf{"%d",&a); while(a!=0); { r=a%2; if(r==0) printf("\n\n THE NUMBER IS EVEN \t"); else printf("\n\n THE NUMBER IS ODD \t"); printf ("\n ENTER THE NUMBER \t"); scanf("%d",&a); } getch(); }
for (int i = 2; i < 10; i ++) printf("%d\n", i); You did say even and odd numbers between 1 and 10. That's allnumbers between 1 and 10.
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.