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
What is define directive?
what will be maximum number of comparisons when number of elements are given?
How to create struct variables?
What are the advantages and disadvantages of pointers?
What is data structure in c programming?
What is sizeof array?
Tell me is null always defined as 0(zero)?
What is the data segment that is followed by c?
What are the types of operators in c?
What is header file definition?
What are the different types of objects used in c?
What is the value of h?
What are pointers? Why are they used?
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?
What does *p++ do? What does it point to?