Advertisement
Abelsor

S3_Ejercicio_9

Mar 4th, 2023
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. // Escriba un programa en C ++ para mostrar el patrón como una triangular usando el alfabeto.
  2.  
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. main(){
  7.    
  8.     int letra = 65; // Poscion de 'A' en la tabla ASCII
  9.     int n;
  10.     cin>>n;
  11.     //Si se inicializa en 0 no se incluye al numero
  12.     for(int i=1 ; i<=n ; i++){
  13.        
  14.        
  15.         for(char j=letra ; (j-(letra-1))<i ; j++){
  16.             cout<<j;
  17.         }
  18.         for(char j=(i)+(letra-1) ; j>=letra ; j--){
  19.             cout<<j;
  20.         }
  21.         cout<<endl;
  22.     }
  23.    
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement