that_one_nigga_you_k

louvre quase pronto

Jun 19th, 2023
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.93 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.  
  5.     int i, n, k, s, pa, ta, pb, tb, b, tot = 0;
  6.  
  7.     printf("digite quantos andares vc quer o orcamento: ");
  8.     scanf("%d", &n);
  9.    
  10.     pa = n*200;
  11.     pb = n*50 - 50;
  12.     b = 2*100*(n-1);
  13.    
  14.     ta = (200 + pa)*n/2;
  15.     tb = ((50 + pb)*n/2)-50;
  16.    
  17.     tot = ta + tb +b;
  18.    
  19.    
  20.  
  21.     for( i = 1 ; i <= n ; i++, k = 0){
  22.  
  23.         for(s = 1 ; s<=n - i ; s++){
  24.             printf(". ");
  25.         }
  26.  
  27.         while(k != 2*i - 1){
  28.             if(k%2 != 0){
  29.                 printf("- ");
  30.             }
  31.            
  32.             else if(k%2 == 0){
  33.                 printf("& ");
  34.             }
  35.             k++;
  36.         }
  37.  
  38.        for(s; s>n - i ; s++){
  39.             if (s>2*n-k-1) break;
  40.             printf(". ");
  41.        }
  42.  
  43.         printf("\n");
  44.     }
  45.     for(int k = 0 ; k <2*n -1 ; k++){
  46.         printf("# ");
  47.     }
  48.    
  49.     printf("\no orçamento total: %d", tot);
  50. }
Add Comment
Please, Sign In to add comment