Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int tmp, i, j;
- printf("Program rysuje gwiazdki w ksztalt trojkata\n");
- printf("liczbe wierszy podaje uzytkownik.\n");
- printf("Autor programu: Lukasz Sowul\n");
- printf("Podaj liczbe wierszy:\n");
- while (scanf("%d", &tmp) != 1 || tmp < 1 || getchar() != '\n'){
- printf("Podano bledne dane. Podaj liczbe gwiazdek jeszcze raz:\n");
- while (getchar() != '\n')
- ;
- }
- for(j=1;j<=tmp;j++){
- for (i=1;i<=(tmp-j);i++){
- putchar(' ');
- }
- for (i=1;i<=(2*j-1);i++){
- putchar('*');
- }
- putchar('\n');
- }
- printf("Koniec programu.\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement