Question: Can I have A flowchart or pseudo-code for below C program code please? #include #include #include int main() { //declaring the variables and array needed

Can I have A flowchart or pseudo-code for below C program code please?

#include

#include

#include

int main()

{

//declaring the variables and array needed in code

float arr[100],in,sum=0,avg;

int n=0;

//infinte loop , its break when user enters 0

while(1){

//reading input from the user

printf("Enter a weight in Kg or 0 to quit : ");

scanf("%f",&in);

//input is 0 while loop stops

if (in==0){

break;

}

//if input is less than 0 , it prints ignore the negative value

else if(in<0){

printf("Ignoring the Negative Value ");

}

//if it is a positive float value , we need to store in array

else if (in>0){

//storing the input in array

arr[n]=in;

//calculating sum

sum+=in;

//incrementing n value here

n+=1;

}

}

//calculating average here

avg = sum/n;

//printing number of entries and average weight here

printf("Number of Entries : %d ",n);

printf("Average Weight : %f ",avg);

//declaring variables

float weight[100];

int i,c=0;

//finding the deviation of weights

for (i=0;i

weight[i] = avg - arr[i];

}

//calculating no of items closest to average

for (i=0;i

{

if (weight[i]==0 || (weight[i]>-1 && weight[i]<1))

c+=1

}

//printing the number of values closest to average here

printf("Number of Items Closest to Average : %d ",c);

printf("The items - weight in kg : ");

for (i=0;i

{

if (weight[i]==0 || (weight[i]>-1 && weight[i]<1))

printf("%f ",arr[i]);

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!