Advertisement
anhkiet2507

Binh Phuong

Apr 14th, 2021
2,302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. const int MAX = 100 ;
  4. int i;
  5. void NhapMang(long a[], int n){
  6.     for(i = 0;i < n; ++i){
  7.         scanf("\n%ld", &a[i]);
  8.     }
  9. }
  10.  
  11. void XuatMang(long a[], int n){
  12.     for(i = 0;i < n; ++i){
  13.         printf("\n%ld", a[i] * a[i]);
  14.     }
  15. }
  16. int main()
  17. {
  18.     long arr[MAX];
  19.     int n;
  20.     do{
  21.         scanf("%d", &n);
  22.         if(n <= 0 || n > MAX){
  23.             return 0;
  24.         }
  25.     }while(n <= 0 || n > MAX);
  26.     NhapMang(arr, n);
  27.     XuatMang(arr, n);
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement