Advertisement
fiqriachmada

SegitigaPascal

Nov 27th, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7.  
  8.     int x, y, a, k, j;
  9.     cout<<"X = ";
  10.     cin>>x;
  11.     cout<<"Y = ";
  12.     cin>>y;
  13.     cout<<"\n";
  14.  
  15.     for(int i=x-1; i<y; i++){
  16.         for(k=0; k<=((2*y)-(2*i)); k++){
  17.             cout<<" ";}
  18.             for(j=0; j<=i; j++){
  19.             if(j==0||i==j){
  20.                 a=1;
  21.                 cout<<"   "<<a;}
  22.             else if(a==5){
  23.                 a=a*(i+1-j)/j;
  24.                 cout<<"   "<<a-10;}
  25.             else if(a==10){
  26.                 a=a*(i+1-j)/j-10;
  27.                 cout<<"   "<<a;}
  28.                 else if(a==0){
  29.                 a=a*(i+1-j)/j;
  30.                 cout<<"   "<<a+5;}
  31.             else{
  32.                 a=a*(i+1-j)/j;
  33.                 cout<<"   "<<a;}
  34.  
  35.         }
  36.         cout<<"\n";
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement