Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- int y,n;char in;
- bool state=true;
- int main()
- {
- while(state){
- int x,y,i,j,k;
- int a=0,b=1,c;
- cout<<"\n X = ";
- cin>>x;
- cout<<" Y = ";
- cin>>y;
- for(i=0; i<=y-1; i++){
- for(j=0; j<=((2*y)-(2*i)); j++){
- cout<< " " ;}
- for(k=0; k<=i; k++)
- {
- c=a+b; b=a; a=c;
- if(i>=x-1)
- {
- cout<<" ";
- cout<<" "<<c%10;
- cout<<" ";
- }
- }
- cout<<endl;
- }
- cout << "\n\n" << "Ulang lagi ?(y/n) -> "; cin >> in;
- if(in == 'n' || in=='N'){
- cout << "Terima Kasih :)" << endl;
- state = false;}
- else if(in == 'y' || in=='Y'){
- cout << "Ok ulang lagi\n" << endl;}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement