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"
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / raju kalyadapu
int main()
{
int i;
while(++i<=100)
{
if(i%3==0)
printf("XXX
");
else if(i%5==0)
printf("YYY
");
else if(i%3==0&&i%5==0)
printf("ZZZ
");
printf("%d
",i);
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
What is the output for the following program #include<stdio.h> main() { char a[5][5],flag; a[0][0]='A'; flag=((a==*a)&&(*a==a[0])); printf("%d\n",flag); }
Write a C program where input is: "My name is xyz". output is: "xyz is name My".
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
what is answer for perfect number????????????????
Total of how many functions are available in c?
write a program to display the numbers in the following 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4
Write a code on reverse string and its complexity.
Explain how can I open a file so that other programs can update it at the same time?
program to get the remainder and quotant of given two numbers with out using % and / operators?
10 Answers College School Exams Tests, IBM,
Why doesnt this code work?
How pointer is benefit for design a data structure algorithm?
Once I have used freopen, how can I get the original stdout (or stdin) back?