Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * sursa1.c
- *
- * Created on: Feb 28, 2020
- * Author: cdamian
- *
- *
- * seria armonica: SA = 1/1 + 1/2 + .... 1/n
- *
- *
- */
- #include<stdio.h>
- int main(){
- int i, n;
- float SA = 0;
- printf("dati n: ");
- scanf("%d", &n);
- for(i = 1; i <=n; i++){
- //printf("1/%d = %f\n", i, 1.0 / i);
- SA = SA + 1.0 / i;
- }
- printf("SA = %.2f\n", SA);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement