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 / vadivel t
#include<stdio.h>
main()
{
int i;
for(i = 1 ; i<=100; i++)
{
if((i%5 == 0) && (i%3 == 0))
printf("ZZZ \n");
else if(i%3 == 0)
printf("XXX \n");
else if(i%5 == 0)
printf("YYY \n");
else
printf("%d \n",i);
}
_getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Write a program to print “hello world” without using semicolon?
Differentiate fundamental data types and derived data types in C.
What is the 'named constructor idiom'?
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
What is null pointer in c?
how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions
Explain the use of 'auto' keyword in c programming?
Why is c so popular?
Where are the auto variables stored?
What are the application of void data type in c?
Can you tell me how to check whether a linked list is circular?
What is the stack in c?
List some applications of c programming language?
Why #include is used in c language?
What does static variable mean in c?