1. Write a program using one dimensional array that
calculates the sum and average of the five input values from
the keyboard and prints the calculated sum and average.
Answer Posted / sreejesh1987
#include<stdio.h>
#include<conio.h>
void main()
{
int i,sum=0,a[4];
float av;
clrscr();
printf("\t\t\tSUM & AVERAGE\n");
printf("Enter Five numbers:");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
av=sum/5;
printf("\nOutput:\n\tSum:%d,Average:%.2f",sum,av);
getch();
}
Is This Answer Correct ? | 57 Yes | 33 No |
Post New Answer View All Answers
create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file
write a program that creates a sequenced array of numbers starting with 1 and alternately add 1 and then 2 to create the text number in the series , as shown below. 1,33,4,6,7,9,............147,148,150 Then , using a binary search , searches the array 100 times using randomly generated targets in the range of 1 to 150
Create a program to read two random data set in two files named data1.txt and data2.txt manifold contains integer numbers, whereas data2.txt file contains the float type numbers. Simpanlahmasing each into 2 pieces of data that is an array of type integer array and an array of type float, then calculate the average numbers in the second array.
Write a (n) algorithm that sorts n distinct integers, ranging in size between 1 and kn inclusive, where k is a constant positive integer. (Hint: Use a kn-element array.)
Code for Method of Handling Factorials of Any Size?
can you please write a program for deadlock that can detect deadlock and to prevent deadlock.
write a program using 2 D that searches a number and display the number of items 12 inputs values input 15,20, 13, 30, 38, 40,16, 18, 20 ,18 ,20 enter no. to search : 20
write a program to convert temperature from fa height into celcius and vise versa,use modular programming
How can I Draw an ellipse in 3d space and color it by using graph3d?
how to take time as input in the format (12:02:13) from user so that controls remains between these columns?
What output does this program generate as shown? Why? class A { A() { cout << "A::A()" << endl; } ~A() { cout << "A::~A()" << endl; throw "A::exception"; } }; class B { B() { cout << "B::B()" << endl; throw "B::exception"; } ~B() { cout << "B::~B()"; } }; int main(int, char**) { try { cout << "Entering try...catch block" << endl; A objectA; B objectB; cout << "Exiting try...catch block" << endl; } catch (char* ex) { cout << ex << endl; } return 0; }
write a program that reads a series of strings and prints only those strings begging with letter "b"
output for printf("printf");
solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)
what mean void creat_object?in public class in this code class A{ public: int x; A(){ cout << endl<< "Constructor A";} ~A(){ cout << endl<< "Destructor A, x is\t"<< x;} }; void create_object(); void main() { A a; a.x=10; { A c; c.x=20; } create_object(); } void create_object() { A b; b.x=30; }