Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

design and implement a program that reads floating-points
numbers in a sentinel-controlled loop until the user
terminates the program by entering zero.your program should
determinate and print the smallest,largest and average of
the supplied numbers.

Answer Posted / sagarraje nimbalkar

// above student asking user How many no. ? but their is no
need to ask because when user want to stop he will enter o(zero)

#include<stdio.h>
#include<conio.h>

void main()
{
int i=1;
float max=0, min=0;
do
{
float n, sum=0, avg=0;
printf("Enter the %d th number: ",i);
scanf("%f",&n);
if(n==0)
exit(0);
else
{
sum=float(sum+n);
if(n>max)
max=n;
else
min=n;
}
i++;
while(1);
printf(" The maximum no. is %f and minimum no. is %f and
average of all no is %f",max,min,sum/i);
getch();
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?

3481


Is it acceptable to declare/define a variable in a c header?

1080


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

3532


What is the maximum no. of arguments that can be given in a command line in C.?

1106


What is c variable?

1014


What is const and volatile in c?

1005


Does * p ++ increment p or what it points to?

1083


What is use of #include in c?

1123


What does main () mean in c?

1081


What is the difference between strcpy() and memcpy() function in c programming?

1047


When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?

1229


What is zero based addressing?

1128


What is meant by int main ()?

1173


What is the auto keyword good for?

1094


How does free() know explain how much memory to release?

1030