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


Please Help Members By Posting Answers For Below Questions

Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop

1718


What are the types of i/o functions?

684


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

655


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?

1591


What is time null in c?

585






What are the different types of errors?

647


Can you define which header file to include at compile time?

590


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)

1863


What is static memory allocation? Explain

632


Define C in your own Language.

642


Explain high-order bytes.

677


What does the format %10.2 mean when included in a printf statement?

1091


What is the difference between a string and an array?

708


Which is better pointer or array?

600


What is stack in c?

615