Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Are there any problems with performing mathematical operations on different variable types?

1044


What is the difference between ++a and a++?

1220


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.

1942


Where define directive used?

1100


Are the outer parentheses in return statements really optional?

1122


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1729


When should the const modifier be used?

1122


What is a null string in c?

1052


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

1006


Can you please explain the difference between syntax vs logical error?

1199


Which header file should you include if you are to develop a function which can accept variable number of arguments?

1408


What is the difference between char array and char pointer?

1064


What is the difference between the = symbol and == symbol?

1129


What is hash table in c?

1026


List the difference between a "copy constructor" and a "assignment operator"?

1026