Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- float s(int x)
- {
- float *liczba,suma;
- int i;
- liczba =(float*)malloc(x*sizeof(int));
- for(i=0;i<x;i++)
- {
- printf("Podaj %d liczbe: ",i+1);
- scanf("%f",&liczba[i]);
- suma=suma+liczba[i];
- }
- return suma;
- }
- int main()
- {
- int x;
- printf("Napisz ilosc liczb ktora chcesz zsumowac: "); scanf("%d",&x);
- printf("\n Suma wynosi : %.2f",s(x));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement