Answer Posted / kamal
* read a number … */
#include <stdio.h>
int main (void) {
int num; /* input number */
int rem; /* remainder …*/
/* get number from user */
printf(“Please enter a number: ”);
scanf(“%d”, &num);
/* calculate remainder … */
rem = num % 2;
if (rem == 0) {
printf(“even\n”);
} else {
printf(“odd\n”);
}
/* terminate program */
return 0;
}
| Is This Answer Correct ? | 4 Yes | 6 No |
Post New Answer View All Answers
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
all c language question
What is cohesion in c?
What's the best way of making my program efficient?
Explain spaghetti programming?
Explain what is the general form of a c program?
Why do we need arrays in c?
What is strcpy() function?
Can you please compare array with pointer?
Is return a keyword in c?
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); } }
Is c language still used?
What is malloc return c?
What is function prototype in c language?
What is c mainly used for?