Code Box
-------------------------------------------
/* Program to print fizz in place of multiple of 3 and buzz in place of 5 */
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
printf("\nEnter start:");
scanf("%d",&j);
printf("\nEnter End:");
scanf("%d",&k);
for(i=j;i<=k;i++)
{
if(i%(3*5)==0)
{
printf("BuzzFizz");
}
else if(i%5==0)
{
printf("Buzz");
}
else if(i%3==0)
{
printf("Fizz");
}
else
{
printf("%d",i);
}
if(i%10==0)
{
printf("\n");
}
else
{
printf("\t");
}
}
getch();
}
No comments:
Post a Comment