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


Please Help Members By Posting Answers For Below Questions

What is define directive?

646


what will be maximum number of comparisons when number of elements are given?

1413


How to create struct variables?

597


What are the advantages and disadvantages of pointers?

587


What is data structure in c programming?

582






What is sizeof array?

619


Tell me is null always defined as 0(zero)?

681


What is the data segment that is followed by c?

619


What are the types of operators in c?

620


What is header file definition?

579


What are the different types of objects used in c?

583


What is the value of h?

599


What are pointers? Why are they used?

636


A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?

1516


What does *p++ do? What does it point to?

624