Created
          January 24, 2023 04:30 
        
      - 
      
- 
        Save 0x73hahd/d1af2601524b0ab0f38a2eceb036926b to your computer and use it in GitHub Desktop. 
    Inverted half pyramid of numbers in rust
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | use std::io; | |
| fn main(){ | |
| let mut rows = String::new(); | |
| io::stdin() | |
| .read_line(&mut rows) | |
| .expect("failed to readline"); | |
| let row = rows.trim().parse::<i64>().unwrap(); | |
| for n in (0..row+1).rev() { | |
| for mut y in (1..n+1) { | |
| print!("{y}"); | |
| } | |
| print!("\n"); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
An example of the output: