Question: #include int main(){ int i, n; double sum = 0.0, sum1 = 0.0, max, min ,number; char answer; printf( Do you know how many stocks

#include int main(){

int i, n; double sum = 0.0, sum1 = 0.0, max, min ,number; char answer;

printf(" Do you know how many stocks you would like to put in? Enter y or n: "); scanf(" %c",&answer); if (answer == 'y'){ printf("Enter the number of stocks you liked to be analzyed: "); scanf("%d",&n); for(i = 0;i

if(max < number) max = number; if(min > number) min = number; } } if(n>0) printf("Average price is: $%.2f ",sum/n); else printf("Average price is 0 "); double variance = sum1/n - (sum/n)*(sum/n); printf("Variance is: $%.2f ",variance); printf("The highest price is: $%.2f ",max); printf("The lowest price is: $%.2f ",min); } }

this is my code so far without using or a array how do I make my else if(answer ==no);

negative number will termninate program but will caculate the values that was entered. so if the user enters

stock 1:20.00

stock2:30.00

stock3:50.00

stock4:-50.00

terminate program these are the mean, variance, min and max of what you entered

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!