fork download
  1. #include <stdio.h>
  2.  
  3. int tonguoc(int n){
  4. int tong = 0;
  5. for(int i = 1; i <= n; i++){
  6. if(n % i == 0){
  7. tong += i;
  8. }
  9. }
  10. return tong;
  11. }
  12.  
  13. int main(){
  14. int N = 60;
  15. printf("Tong uoc cua N : %d\n", tonguoc(N));
  16. }
Success #stdin #stdout 0s 5272KB
stdin
Standard input is empty
stdout
Tong uoc cua N : 168