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


Please Help Members By Posting Answers For Below Questions

Implement a command console for changing settings on a particular object. The command console should allow you to enter a string and will return the response (very similar to a terminal session). The commands are as follows: SET propertyname=newvalue will change the target object’s member named “propertyname” to have a value equal to “newvalue”. If the input value is incompatible (i.e. an int being set to a string), print out an appropriate error message. GET propertyname will print out the current value of the target object’s member named “propertyname”. GET * will print out a list of all target object members and their current values. The system should be extensible for future commands and should accept an arbitrary object, such that another developer could insert another object into the system and rely on the command console to get and set the properties correctly.

3398


find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L

2010


We need to write the function to check the password entered is correct or not based on the following conditions.. a) It must have atleast one lower case character and one digit. b)It must not have any Upper case characters and any special characters c) length should be b/w 5-12. d) It should not have any same immediate patterns like abcanan1 : not acceptable coz of an an pattern abc11se: not acceptable, coz of pattern 11 123sd123 : acceptable, as not immediate pattern adfasdsdf : not acceptable, as no digits Aasdfasd12: not acceptable, as have uppercase character

3957


i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.

1970


Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37

2198






Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++

552


How to Split Strings with Regex in Managed C++ Applications?

3129


Code for Method of Handling Factorials of Any Size?

2007


write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used

4310


output for printf("printf");

1985


can you please write a program for deadlock that can detect deadlock and to prevent deadlock.

2748


develop a program to calculate and print body mass index for 200 employees

2216


Ask the user to input three positive integers M, N and q. Make the 2 dimensional array of integers with size MxN, where all the elements of I (I = 1,…,M) line will be members of geometrical progression with first element equal to the number of line (I) and denominator q.

3397


Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).

3193


write a program to convert temperature from fa height into celcius and vise versa,use modular programming

2441