Monday, 4 April 2016

Hacker Earth solution for Its all about magic in C++

Problem:- It's all about magic! Solution Hacker Earth Solution or Its all about magic! Solution hacker rank solution c++ orMulti Level Inheritance in java or Its all about magic! Solution or Its all about magic! The solution in C++ or Its all about magic! Solution hacker rank solution in Java or Its all about magic! Solution hacker rank solution c++ or Its all about magic! Solution hacker rank solution c++ or Its all about magic! Solution program in c or Its all about magic! A solution in C or Hacker Earth Solution For Its all about magic! The solution in C++ or Its all about magic! A solution in C++ or Hacker Earth solution for Its all about magic! A solution in C++.



Question:- Recently Oz has found a magical string consisting of the single digit "1". After experimenting on the string, Oz found a weird magical property of the string that is whenever he touches the string then each digit "1" of string changed to the digit "0" and
each digit "0" of string changed to "01". Oz found this property interesting and immediately asked a question to RK :
"How many 1's and 0's will be in the magical string if he touches the string M times ?"

Input :
The first line contains the number of test cases T. Each test case consists of a positive integer - M.

Output :
For each test case output two space-separated integers, number of 1's and number of 0's in the magical string if Oz
 touches the string M times.

Constraints :
1<= T <=20
1<= M <=90

Sample Input (Plaintext Link)
2
1
2
Sample Output (Plaintext Link)
0 1
1 1


Check- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard Domain.


Copy the full solution or colored code and paste into the hacker earth editor and click to Run Code if the code runs successfully then click to Submit Code.

Submit your solution here:- Click here


Solution:-

#include<iostream>
using namespace std;
int main()
{
 //Ghanendra
 int t=0,m=1,n,i,j,t1;
 int a1=1,a2=1;

 cout<<"Enter the no of times Sample Input\n\n";
 cin>>n;
 cout<<t<<"  "<<m<<endl;
 for(i=0;i<n;i++)
 {
 cout<<a1<<"  "<<a2<<endl;
 t1=a1;
 a1=a2;
 a2=a2+t1;
 }
}


Output:-


Hacker Earth solution for Its all about magic! in C++



You May Like This:-

1. Java Program For Find The Salary Of An Employee With Employee Grade

2. Java Program to Convert a person's name in Abbreviated

3. C Program For Calculator Using Switch Case

4. C++ Program For Bubble Sort

5. Java Program For Find The Gross Salary Of An Employee

6. Hacker Rank Solution For Birthday Cake Candles

7. C++ Program For Store Employee Information And Display Using Structure

8. C Program For Find A Grade Of Given Marks Using Switch Case

9. C Program For HEAP Sort In Ascending Order Also Show Complexity

10. C++ Program For Selection Sort Using Function

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment