#include <stdio.h>
int main()
{
int n;
float num;
printf("Enter n: ");
scanf("%d",&n);
float sum=0;
for(int i=0;i<n;i++){
printf("Enter the number: ");
scanf("%f",&num);
sum=sum+num;
}
printf("Cumulative sum= %f",sum);
return 0;
}
Comments
Leave a comment