To find whether a number is even or odd without using any
conditional operator??
Answer Posted / jai gomathi
/*PROGRAM BY JAI GOMATHI.NS, B.E.*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
char a["oddnumber","evennumber"];
printf("\nEnter a number: ");
scanf("%d",&n);
printf("%s",a[n%2]); //when odd, a[1] will print odd number
getch();
}
| Is This Answer Correct ? | 9 Yes | 3 No |
Post New Answer View All Answers
program to convert a integer to string in c language'
Explain the difference between exit() and _exit() function?
What is enumerated data type in c?
What is a pointer value and address in c?
What is keyword with example?
Write a factorial program using C.
what is event driven software and what is procedural driven software?
What is indirection in c?
What are the features of the c language?
Explain what does the format %10.2 mean when included in a printf statement?
Why can arithmetic operations not be performed on void pointers?
What are lookup tables in c?
What is typedef struct in c?
Why c is faster than c++?
Explain what are global variables and explain how do you declare them?