what is the other ways to find a logic to print whether a
number is an even or odd wit out using % symbol??????? i
know three different ways to print it. so i need any other
different logic>>>>>
Answer Posted / tirtharaj dash@nist
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,r,i;
scanf("%d",&b);
int temp=b;
for(i=1;i<=b/2;i++)
{
r=temp-2*i;
}
if(r==0)
printf("\neven...");
else
printf("\nodd");
getch();
return 0;
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How can I remove the leading spaces from a string?
What are the string functions? List some string functions available in c.
If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402
What is meant by gets in c?
How do you list files in a directory?
What does c value mean?
How are 16- and 32-bit numbers stored?
What is assignment operator?
How can I split up a string into whitespace-separated fields?
Explain how can a program be made to print the line number where an error occurs?
how to execute a program using if else condition and the output should enter number and the number is odd only...
What is calloc in c?
What are the difference between a free-standing and a hosted environment?
Why we use conio h in c?
What is static volatile in c?