ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
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.
 Question Submitted By :: Jhenniza
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
#include<stdio.h>
#define MAX 20
int main()
{
	float no,a[MAX],sum=0.0,avg;
	int n,i;
	float min,max;
	printf("\n Enter How Many Numbers:");
	scanf("%d",&n);
	i=0;
	min=0;
	max=0;
	do
	{
		printf("\n Enter a number(Enter 0 to 
stop):");
		scanf("%f",&no);
		a[i]=no;
		if(no==0)
			break;
		else
		{
			if(a[i]<min)
				min=a[i];
			else if(a[i]>max)
				max=a[i];
			sum=sum+a[i];
		}	
		i++;
	}
	while(i<n);
	avg=sum/i;
	printf("\n The Smallest Number is:%f",min);
	printf("\n The Largest Number is:%f",max);
	printf("\n The Average of Entered %d numbers is:%.2f
\n",i,avg);
}
 
Is This Answer Correct ?    1 Yes 0 No
Yogesh
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
How can I call a function, given its name as a string? ABC-Telecom2
what is link list?  2
what is the differance between pass by reference and pass by value. Infosys4
what is the diference between pointer to the function and function to the pointer?  2
what are brk, sbrk? Oracle1
please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i); printf("%d",i); getch(); }  3
which one is highest Priority in c? a)=,b)+,c)++,d)==  3
Is the following code legal? struct a { int x; struct a b; }  3
what is difference between array and structure? TCS19
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+.... Ignou2
a=0; b=(a=0)?2:3; a) What will be the value of b? why b) If in 1st stmt a=0 is replaced by -1, b=? c) If in second stmt a=0 is replaced by -1, b=? Geometric-Software6
write a 'c' program to sum the number of integer values  5
write a code for large nos multilication (upto 200 digits) Persistent1
which will be first in c compiling ,linking or compiling ,debugging. Sonata3
I use turbo C which allocates 2 bytes for integers and 4 bytes for long. I tried to declare array of size 500000 of long type using the following code... long *arr; arr=(long *)(malloc)(500000 * sizeof(long)); It gives a warning that "Conversion may lose significant digits in function main"... And the resulting array size was very less around 8400 as compared to 500000. Any suggestions will be welcomed....  2
To what value are pointers initialized? 1) NULL 2) Newly allocated memory 3) No action is taken by the compiler to initialize pointers.  2
could u able to tell about suresoft technical session  1
DIFFERNCE BETWEEN THE C++ AND C LANGUAGE? Wipro1
C program to find frequency of each character in a text file?  3
2. Counting in Lojban, an artificial language developed over the last fourty years, is easier than in most languages The numbers from zero to nine are: 0 no 1 pa 2 re 3 ci 4 vo 5 mk 6 xa 7 ze 8 bi 9 so Larger numbers are created by gluing the digit togather. For Examle 123 is pareci Write a program that reads in a lojban string(representing a no less than or equal to 1,000,000) and output it in numbers. Nagarro2
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com