Advertisement
Guest User

Zadanie 2 całe dobrze

a guest
Nov 16th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include "time.h"
  4. #include <cstdlib>
  5. #include <windows.h>
  6. #include <cmath>
  7.  
  8. using namespace std;
  9. using namespace std;
  10. int main()
  11. {
  12. int a,i,k,l;
  13. char b;
  14. do{
  15. cout << "Podaj dlugosc podstawy trojkata: ";
  16. cin >> a;
  17. }
  18.  
  19.  
  20. while (a<1 || a>21 || a%2==0);
  21.  
  22. cout<<"dobrze"<<endl;
  23. cout << "Podaj znak: ";
  24. cin >> b;
  25.  
  26.  
  27.  
  28.  
  29.  
  30. for (k=1; k<a+1; k=k+2)
  31. {
  32. for (l=1; l<a-k; l=l+2)
  33. {
  34. cout << " ";
  35. }
  36. for (i=1; i<k+1; i++)
  37. {
  38. cout << b;
  39. }
  40. cout << endl;
  41. }
  42.  
  43.  
  44.  
  45.  
  46. cin.ignore();
  47. getchar ();
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement