# include
void main()
{
int a;
printf("\n Enter a number to find if its odd or even");
scanf("%d",&a);
if(a%2==0)
{
printf("\n The number entered is even");
}
else
{
printf("\n The number entered is odd");
}
getch();
}
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.
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
#include
1. Read in 'n'2. Output n*(n+1)/2> Check the no. in odd or even?Both possible, has no significance.
#include <stdio.h> int main() { printf("Program to find ODD or Even Number\n"); while(1) { int n = 0; printf("\nEnter a number(-1 for Exit): "); scanf("%d",&n); if( n 0) { printf("%d is a EVEN number.\n", n); } else { printf("%d is a ODD number.\n", n); } } return 0; }
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.
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
#include <stdio.h> main() { int n, odd=0, even=0; while (scanf("%d",&n)&&(n!=0)) (n%2)?++odd:++even; printf("odd: %d even: %d\n",odd,even); }
For any number n you could use * (n % 2 == 0), which would be true for an even number, false for odd For an integer i, a simpler method would be * (i & 1), which would be true for an odd number, false for even
Yes. If n is odd, then n + c where c is an even constant will be odd. n + d where d is an odd constant will be even.
odd loop means at least the loop execute once.
Even b/c if the last number is even then even and if the last number is odd then the number is odd so 986 _6_ is even
No. Two odd numbers added together always give an even number. Two even numbers added together always give an even number. An odd and an even number added together always give an odd number. So, if we have 5 odd numbers - a, b, c, d and e a + b will be even c + d will be even So if (a + b) + (c + d) is even, adding e to that will have to be an odd number - but 50 is even, so it cannot be done.
#include
1. Read in 'n'2. Output n*(n+1)/2> Check the no. in odd or even?Both possible, has no significance.
#include <stdio.h> int main() { printf("Program to find ODD or Even Number\n"); while(1) { int n = 0; printf("\nEnter a number(-1 for Exit): "); scanf("%d",&n); if( n 0) { printf("%d is a EVEN number.\n", n); } else { printf("%d is a ODD number.\n", n); } } return 0; }
Even (unless c = 0 in which case it is either or both!)