that_one_nigga_you_k

louvre final

Jun 19th, 2023 (edited)
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.07 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.     pb = (n-1)*50;
  11.     pa = n*200;
  12.     b = 100*(2*n-1);
  13.    
  14.     if(n<2) pb = 0;
  15.    
  16.     ta = ((200 + pa)*n)/2;
  17.     tb = ((50 + pb)*(n-1))/2;
  18.    
  19.     if(n<2) tb = 0;
  20.    
  21.     tot = ta + tb +b;
  22.    
  23.    
  24.  
  25.     for( i = 1 ; i <= n ; i++, k = 0){
  26.  
  27.         for(s = 1 ; s<=n - i ; s++){
  28.             printf(".");
  29.         }
  30.  
  31.         while(k != 2*i - 1){
  32.             if(k%2 != 0){
  33.                 printf("-");
  34.             }
  35.            
  36.             else if(k%2 == 0){
  37.                 printf("&");
  38.             }
  39.             k++;
  40.         }
  41.  
  42.        for(s; s>n - i ; s++){
  43.             if (s>2*n-k-1) break;
  44.             printf(".");
  45.        }
  46.  
  47.         printf("\n");
  48.     }
  49.     for(int k = 0 ; k <2*n -1 ; k++){
  50.         printf("#");
  51.     }
  52.    
  53.     //printf("\no orçamento total: %d, %d, %d, %d, %d, %d", tot, ta, tb, pa, pb, b);
  54.     printf("\nO valor total foi: %d", tot);
  55. }
Add Comment
Please, Sign In to add comment