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
C program to find all possible outcomes of a dice?
If the size of int data type is two bytes, what is the range of signed int data type?
What are the basic data types associated with c?
Can you think of a logic behind the game minesweeper.
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
Is c language still used?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }
What is keyword in c?
Is a pointer a kind of array?
Why is event driven programming or procedural programming, better within specific scenario?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
What is a method in c?
Why void main is used in c?
What are the application of void data type in c?