Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.12 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int sumailoczyn(int a, int b, int * c){
  4.     int suma = a+b;
  5.     * c = a*b;
  6.     return suma;
  7. }
  8.  
  9.  
  10. int main()
  11. {
  12.  
  13.     int a, b, x=0;
  14.  
  15.     do{
  16.  
  17.         printf("Podaj a: ");
  18.         scanf("%d", &a);
  19.         printf("Podaj b: ");
  20.         scanf("%d", &b);
  21.         printf("%d, %d", sumailoczyn(a, b, &x), x);
  22.         printf("\n");
  23.  
  24.     }while(a!=0 && b!=0);
  25.  
  26.     int h, pozycja, spacje=0, znaki=0;
  27.     char c;
  28.  
  29.     podajwys:
  30.     printf("Podaj wysokosc: ");
  31.     scanf("%d", &h);
  32.  
  33.     if(h<1) printf("Wpisano zla wysokosc: ");
  34.     if(h<1) goto podajwys;
  35.     //znak
  36.     if(h%2==0) c='*';
  37.     if(h%2==1) c='#';
  38.     znaki=0;
  39.  
  40.     startrysuj:
  41.     pozycja=0;
  42.     spacje=h-znaki;
  43.  
  44.     rysujspacje:
  45.     printf(" ");
  46.     spacje--;
  47.     if(spacje>0) goto rysujspacje;
  48.     goto rysujznaki;
  49.  
  50.     rysujznaki:
  51.     printf("%c", c);
  52.     if(pozycja>=2*znaki) goto nastepnalinia;
  53.     pozycja++;
  54.     goto rysujznaki;
  55.  
  56.     nastepnalinia:
  57.     printf("\n");
  58.     znaki++;
  59.     if(znaki<h) goto startrysuj;
  60.     goto koniec;
  61.  
  62.     koniec:
  63.     if(h==7) return 1;
  64.     goto podajwys;
  65.  
  66.     return 0;
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement