Advertisement
NuyenTrongHa

tam

Sep 9th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #define CLGT "dechkonmo\n"
  3. #define PAS 12345
  4.  
  5. int main(){
  6.  
  7. int vitri,i,j,k,n,h;
  8. char c;
  9. do
  10. {
  11. printf("chieu cao cua tam giac la: ");
  12. scanf("%d",&h);
  13. if (h%2==0)
  14. k=h/2+1;
  15. else k=h/2+2;
  16. for (i=1;i<=h;i++)
  17. {
  18. printf(" ");
  19. for (vitri=1;vitri<=h-i;vitri++)
  20. printf(" ");
  21. printf("*");
  22. for (;vitri<h;vitri++)
  23. {
  24. if (i==h)
  25. printf("* ");
  26. else
  27. printf(" ");
  28.  
  29. }
  30. printf("*\n");
  31.  
  32. }
  33. printf("choi tiep(Y)/(N) ");
  34. c=getch(c);
  35.  
  36. }
  37. while(c=='y'||c=='Y');
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement