35657

Untitled

Dec 2nd, 2023
779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5.  
  6.  
  7. void PrintRectangle(int N, int K) {
  8.     for (int i = 0; i < N; i++) {
  9.         for (int j = 0; j < K; j++) {
  10.             if (i == 0 || i == N - 1 || j == 0 || j == K - 1) {
  11.                 cout << '*';
  12.             }
  13.             else {
  14.                 cout << " ";
  15.             }
  16.         }
  17.         cout << endl;
  18.     }
  19. }
  20.  
  21. int fact(int N) {
  22.     int result = 1;
  23.     for (int i = 1; i <= N; i++) {
  24.         result *= i;
  25.     }
  26.     return result;
  27. }
  28.  
  29.  
  30. int main() {
  31.    
  32.     PrintRectangle(6, 15);
  33.  
  34.     int a = fact(5);
  35.  
  36.     cout << a << endl;
  37.    
  38. }
Advertisement
Add Comment
Please, Sign In to add comment