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 / mhaine mercado
#include<stdio.h>
main()
{
int i,n[5]
float sum,ave;
printf("\nEnter five numbers:");
for(i=0;i<5;i++)
{
scanf("%d",&n[i]);
}
sum=0;
for(i=0;i<5;i++){
sum=sum+n[i];
}
ave=sum/5;
printf("\nThe sum is: %f",sum);
printf("\nThe average is: %f",ave);
getch();
}
Is This Answer Correct ? | 32 Yes | 19 No |
Post New Answer View All Answers
Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?
Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?
write a program that reads a series of strings and prints only those strings begging with letter "b"
Code for Two Classes for Doing Gzip in Memory?
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
A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect
write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used
write a program that can LOCATE and INSERT elements in array using c++ programming languages.
can you please write a program for deadlock that can detect deadlock and to prevent deadlock.
Write a simple encryption program using string function which apply the substitution method.
Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)
How to swap two ASCII numbers?
how to take time as input in the format (12:02:13) from user so that controls remains between these columns?
Write a program that print in screen a tree with its height taken from user by entering number of 4 digits and find the odd numbers then calculate the sum of odd numbers so he get the height of tree?