fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4. void nhapmang(int a[], int &n){
  5. printf("nhap vao so luong phan tu: ");
  6. scanf("%d", &n);
  7. for(int i=0; i<n;i++){
  8. printf("A[%d]= ",i);
  9. scanf("%d", &a[i]);
  10. }
  11. }
  12.  
  13. void xuatmang(int a[], int n){
  14.  
  15. printf("cac phan tu trong mang la : ");
  16. for(int i=0;i<n;i++){
  17. printf("\nA[%d]= %d", i,a[i]);
  18. }
  19. }
  20.  
  21. int sochinhphuong(int x)
  22. {
  23. int i,n;
  24. for( i=0; i<n;i++)
  25. {
  26. if(sqrt(x)*sqrt(x)==x)
  27. return 1;
  28. return 0;
  29. }
  30.  
  31. }
  32.  
  33. void inrasochinhpguong(int a[], int n){
  34. for(int i=0;i<n;i++){
  35. if(sochinhphuong(a[i])){
  36. printf("\nSCP= %d\n\t\t", a[i]);
  37. }
  38. if(sochinhphuong(a[i])==0)
  39. printf("khong co SCP");
  40.  
  41. }
  42. }
  43.  
  44. main()
  45. {
  46. int n, a[100];
  47. nhapmang(a,n);
  48. xuatmang(a,n);
  49. inrasochinhpguong(a,n);
  50.  
  51. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:4:28: error: expected ';', ',' or ')' before '&' token
 void nhapmang(int a[], int &n){
                            ^
prog.c:44:1: warning: return type defaults to 'int' [-Wimplicit-int]
 main()
 ^
prog.c: In function 'main':
prog.c:47:2: warning: implicit declaration of function 'nhapmang' [-Wimplicit-function-declaration]
  nhapmang(a,n);
  ^
prog.c: In function 'sochinhphuong':
prog.c:31:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
stdout
Standard output is empty