BUZZ - CPPIOU005

Description:

In the standard version of the math game Buzz, players begin counting and whenever a player reaches a number that has seven as a digit or is divisible by seven, he says "Buzz" instead of the number. Numbers such as seventy require the player to say "Buzz Buzz". Once because the number contains the digit "7" and once because the number is divisible by "7". However, if one of the two properties holds more than once (for example, the number 771 contains the digit 7 twice) the player only says "Buzz" once for each property that holds. SRM team is about to participate in the game of Buzz and the SRM Buzz team coach requests you to help him in automating this training program by writing a program. Can you please help him out? Given an input integer, write a program to print the number and the number of times the word buzz needs to be said. Input Format : Input consists of a single integer. Input and Output Question ID 1211110034 : Swap numbers using temporary variable Problem Description Swap the two given numbers using temporary variable Test Case 1 Input (stdin) 10 20 Expected Output Before a=10 b=20 After a=20 b=10 Test Case 2 Input (stdin) 6 3 Expected Output Before a=6 b=3 After a=3 b=6

Program :

#include <iostream>

 using namespace std;

 class pro { public: void swap(int &a, int &b)

 {

 b = a + b;

 a = b - a;

b = b - a;

 } };

 int main()

{

 int a, b;

 pro s1;

 cout << "Before";

cin >> a >> b; cout<<"\n";

cout<<"a="<<a<<" b="<<b;

 s1.swap(a, b);

 cout<<endl;

 cout << "After\n";

 cout << "a=" << a << " b=" << b;

return 0;

 }