plz answer.... write a program that reads line (using
getline) e.g."345", converts each line to an integer
using "atoi" and computes the average of all the numbers
read. also compute the standard deviation.



plz answer.... write a program that reads line (using getline) e.g."345", converts each ..

Answer / dally

#include<stdio.h
int main()
{
char array[]= "345";
int n;
n = atoi(array);
while(n>1)
{
int sum,aveg,no=1;
n = n%10;
no++;
sum = sum+n;
n=n/10;
}
aveg= sum/no;
printf("Aveg of number %d\n",aveg);

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More C Interview Questions

how can I convert a string to a number?

0 Answers  


#include<stdio.h> main() { int a[3]; int *I; a[0]=100;a[1]=200;a[2]=300; I=a; Printf(“%d\n”, ++*I); Printf(“%d\n”, *++I); Printf(“%d\n”, (*I)--); Printf(“%d\n”, *I); } what is the o/p a. 101,200,200,199 b. 200,201,201,100 c. 101,200,199,199 d. 200,300

4 Answers   Tieto,


Why main is not a keyword in c?

0 Answers  


Given a piece of code int x[10]; int *ab; ab=x; To access the 6th element of the array which of the following is incorrect? (A) *(x+5) (B) x[5] (C) ab[5] (D) *(*ab+5} .

2 Answers   Oracle,


What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?

0 Answers  






List some of the static data structures in C?

0 Answers  


What is scope of variable in c?

0 Answers  


Lists the benefits of c programming language?

0 Answers  


What is the sizeof () operator?

0 Answers  


Go through the following code sinippet char a[20]; a="Hello Orcale Test"; will this compile?

4 Answers   Oracle,


what is the use of using linked list and array?

10 Answers   Infosys, TCS,


What is stack in c?

0 Answers  


Categories