find even number in array
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.
#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; }
swap(&grades[num],&grades[num+1]); what it make in a program?
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
find even number in array
No, thanks.
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.
#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; }
This program checks whether a number is odd or even. NOTE: This site removes formatting from answers. Replace (tab) with a tab or four spaces. #!/usr/bin/python print("Type a number.") n = input(": ") l = len(n)-1 even = ("02468") if n[l] in even: (tab)print(n, "is even.") if n[l] not in even: (tab)print(n, "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
swap(&grades[num],&grades[num+1]); what it make in a program?
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
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
c is programming laungage
Oh good old-fashioned C. void main() { int variable_name = [Any number goes here]; if (variable_name % 2 == 0) { printf("%d is even.", variable_name); } else { printf("%d is odd.", variable_name); } } I think I've helped enough, so it's up to you to learn how to get input from the user, if that's what you're working on.
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(); }