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
Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop
What are the types of i/o functions?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
What is time null in c?
What are the different types of errors?
Can you define which header file to include at compile time?
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
What is static memory allocation? Explain
Define C in your own Language.
Explain high-order bytes.
What does the format %10.2 mean when included in a printf statement?
What is the difference between a string and an array?
Which is better pointer or array?
What is stack in c?