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 defrenece between structure and union
Explain the difference between #include "..." And #include <...> In c?
What extern c means?
A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile
write a program that will read the temperature in Celsius and convert that into Fahrenheit.
How pointers are declared?
What is the difference between memcpy and memmove?
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
Which is better oop or procedural?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
What kind of structure is a house?
what are far pointers?