Advertisement
Asparte

Untitled

Dec 18th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.     int tmp, i, j;
  5.     printf("Program rysuje gwiazdki w ksztalt trojkata\n");
  6.     printf("liczbe wierszy podaje uzytkownik.\n");
  7.     printf("Autor programu: Lukasz Sowul\n");
  8.     printf("Podaj liczbe wierszy:\n");
  9.     while (scanf("%d", &tmp) != 1 || tmp < 1 || getchar() != '\n'){
  10.         printf("Podano bledne dane. Podaj liczbe gwiazdek jeszcze raz:\n");
  11.         while (getchar() != '\n')
  12.             ;
  13.     }
  14.     for(j=1;j<=tmp;j++){
  15.         for (i=1;i<=(tmp-j);i++){
  16.             putchar(' ');
  17.         }
  18.         for (i=1;i<=(2*j-1);i++){
  19.             putchar('*');
  20.         }
  21.         putchar('\n');
  22.     }
  23.     printf("Koniec programu.\n");
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement