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 / abhisekh_banerjee
#include<stdio.h>
void main()
{
int i,n=0,m=0;
for(i=1;i<=100;i++)
{
n=i%3;
m=i%5;
if(n==0 && m!=0)
printf(" XXX ");
else if(m==0 && n!=0)
printf(" YYY ");
else if(n==0 && m==0)
printf(" ZZZ ");
else
printf("%d ",i);
}
}
| Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
What is the purpose of void in c?
What is keyword with example?
How can I get back to the interactive keyboard if stdin is redirected?
Write a program of advanced Fibonacci series.
c language interview questions & answer
What is a pointer in c plus plus?
What is conio h in c?
Can include files be nested?
What is enumerated data type in c?
What do you mean by command line argument?
What is the g value paradox?
Difference between pass by reference and pass by value?
What are different types of operators?
Is c language still used?
What is the difference between union and anonymous union?