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 |
List the variables are used for writing doubly linked list program.
while initialization of two dimensional arrays we can initialize like a[][2] but why not a[2][] is there any reason behind this?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
Explain can the sizeof operator be used to tell the size of an array passed to a function?
Explain the properties of union. What is the size of a union variable
what would be the output of the following prog? Justify your answer? main() { unsigned char ch; unsigned char i; ch = -255; printf("%d",ch); i = -1; printf("%d",i); }
What is variable initialization and why is it important?
write a c program to print "Welcome" without using semicolon in the whole program ??
how to make program without <> in library.
1 What is a Data Structure?
Does c have enums?
which is conditional construct a) if statement b) switch statement c) while/for d) goto