:#include<stdio.h>

#include<conio.h>
void main() 
{

int i;

float x[10],value,total;
clrscr();
printf("enter ten real numbers");
for(i=0;i<10;i++)
{
scanf("%f",value);
x[i]=value;
}
total=0.0;
for(i=0;i<10;i++)
total=total+x[i]*x[i];//eliminate total from here 
printf("/n")
for(i=0;i<10;i++)
printf("[%2d]=%5.2f/n",i+1,x[i];
printf("total=%2f/n",total);
}

if i write total=x[i]x[i] =102 an another answer why??
nd if wrie=total=total+x[i]
x[i] =446.86
10 real number 1.1, 2.2 ,3.3 ,4.4 ,5.5 ,6.6 ,7.7, 8.8, 9.9 ,10.10.

Recommended Answers

All 3 Replies

its x[i]*x[i]...

Check the reading part again, the way you are reading the elements is wrong.

scanf("%f",value);

this should be :

scanf("%f",&value);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.