Header Ads

Learn Together, Stay Connected.

FizzBuzz-C


#include<stdio.h>
#include<math.h>
int main()
{
int x,y,n;
scanf("%d %d %d",&x,&y,&n);
if(n%x==0 && n%y==0)
{
printf("FizzBuzz");
}
else if(n%x==0 && n%y!=0)
{
printf("Fizz");
}
else if(n%x!=0 && n%y==0)
{
printf("Buzz");
}
else if(n%x!=0 && n%y!=0)
{
printf("%d",n);
}
return 0;
}

No comments

Theme images by Dizzo. Powered by Blogger.