WAP that prints the number from 1 to 100. but for multiplies of
three print "XXX" instead of the number and for the multiplies of
five print "YYY" . for number which are multiplies of both three
and five print "ZZZ"
Answer Posted / vadivel t
#include<stdio.h>
main()
{
int i;
for(i = 1 ; i<=100; i++)
{
if((i%5 == 0) && (i%3 == 0))
printf("ZZZ \n");
else if(i%3 == 0)
printf("XXX \n");
else if(i%5 == 0)
printf("YYY \n");
else
printf("%d \n",i);
}
_getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Explain what is output redirection?
What is the purpose of void pointer?
What is the -> in c?
Explain goto?
What is a null string in c?
How do I swap bytes?
Is there a way to jump out of a function or functions?
What are the three constants used in c?
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
Why isnt any of this standardized in c?
What is typedf?
What is the difference between text files and binary files?
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
When is a “switch” statement preferable over an “if” statement?
What is null pointer constant?