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);
- pa = n*200;
- pb = n*50 - 50;
- b = 2*100*(n-1);
- ta = (200 + pa)*n/2;
- tb = ((50 + pb)*n/2)-50;
- 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", tot);
- }
Add Comment
Please, Sign In to add comment