Write a program which iterates the integers from 1 to 100 Fo
Write a program which iterates the integers from 1 to 100. For multiples \"Fizz\" instead of the number and for the multiples of five print Buzz which are multiples of both three and five print\"FizzBuzz For multiples of three print int \"Buzz\" For numbers \". Otherwise p rint the numbers
Solution
Answer:
23)
#include <stdio.h>
int main(){
int i;
for(i = 1; i <= 100; i++){
if(i % 15 == 0)
printf(\"FizzBuzz\ \");
else if(i % 3 == 0)
printf(\"Fizz\ \");
else if(i % 5 == 0)
printf(\"Buzz\ \");
else
printf(\"%d\ \", i);
}
return 0;
}
Output :
22)
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
cout<<\"Please enter name: \";
cin >>name;
while (name!=\"\") {
cout <<\"Entered name is:\"<<name;
cin >> name;
}
return 0;
}
