fork download
  1. #include <stdio.h>
  2.  
  3. int main (void){
  4. int N, i;
  5. float res = 0;
  6. puts("Digite um valor: ");
  7. scanf("%d", &N);
  8.  
  9. for( i = 1 ; i <= N; i++){
  10. res += (float)i/((N - i) + 1);
  11. }
  12. printf("%.2f\n", res);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 2012KB
stdin
2
stdout
Digite um valor: 
2.50