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 should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
What is C++
Which are low level languages?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
What does extern mean in a function declaration?
Write a program which take a integer from user and tell whether the given variable is squar of some number or not. eg: is this number is 1,4,9,16... or not
wat are the two methods for swapping two numbers without using temp variable??
code for bubble sort?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
What are the different pointer models in c?
can u write a program in C, which does not use = (eqaul)or any arithmatic assignment(like -=,+=,*= etc) operator to swap to number?
pointer_variable=(typecasting datatype*)malloc(sizeof(datatype)); This is the syntax for malloc?Please explain this,how it work with an example?
2 Answers eClerx, Excel, kenexa,