Write a program to find given number is even or odd without
using any control statement.
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / saneemask
main()
{
{
char a[][5]= {"Even","Odd"};
int n;
printf("Enter any no.: ");
scanf("%d",&n);
printf("%s",a[n%2]);
getch();
}
{
| Is This Answer Correct ? | 3 Yes | 0 No |
How can I trap or ignore keyboard interrupts like control-c?
Which control loop is recommended if you have to execute set of statements for fixed number of times?
How many main () function we can have in a project?
Explain the bubble sort algorithm.
Explain the use of 'auto' keyword in c programming?
where do we use volatile keyword?
What is time null in c?
Does c have circular shift operators?
how to calculate the time complexity of a given algorithm? pls give exaples..mainly for the coplexities such as O(log n),O(n log n)...
what are the advantages of a macro over a function?
What is the difference between far and near ?
What is macro?