Write a program to find given number is even or odd without
using any control statement.

Answer Posted / rani

#include<stdio.h>
#include<conio.h>
void main()
{
char str[][10]={"even","odd"};
int no;
clrscr();
printf("\nEnter a number...");
scanf("%d",&no);
printf("\n%d is %s",no,str[no%2]);
getch();
}

Is This Answer Correct ?    13 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does 3 mean in texting?

619


What is the difference between functions abs() and fabs()?

651


pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)

1865


What is an arrays?

658


What is wrong with this code?

698






What is c definition?

752


Why is sprintf unsafe?

621


What are the types of type specifiers?

625


a value that does not change during program execution a) variabe b) argument c) parameter d) none

699


Write a program to print “hello world” without using semicolon?

677


what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?

1456


What is the difference between malloc() and calloc()?

619


What is pragma in c?

631


What is external variable in c?

617


Write a program to print ASCII code for a given digit.

690