Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int i, n, k, s, pa, ta, pb, tb, b, tot = 0;
- //printf("digite quantos andares vc quer o orcamento: ");
- scanf("%d", &n);
- pb = (n-1)*50;
- pa = n*200;
- b = 100*(2*n-1);
- if(n<2) pb = 0;
- ta = ((200 + pa)*n)/2;
- tb = ((50 + pb)*(n-1))/2;
- if(n<2) tb = 0;
- tot = ta + tb +b;
- for( i = 1 ; i <= n ; i++, k = 0){
- for(s = 1 ; s<=n - i ; s++){
- printf(".");
- }
- while(k != 2*i - 1){
- if(k%2 != 0){
- printf("-");
- }
- else if(k%2 == 0){
- printf("&");
- }
- k++;
- }
- for(s; s>n - i ; s++){
- if (s>2*n-k-1) break;
- printf(".");
- }
- printf("\n");
- }
- for(int k = 0 ; k <2*n -1 ; k++){
- printf("#");
- }
- //printf("\no orçamento total: %d, %d, %d, %d, %d, %d", tot, ta, tb, pa, pb, b);
- printf("\nO valor total foi: %d", tot);
- }
Add Comment
Please, Sign In to add comment