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.
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
Algorithm in O(2n) Presently we can solve in our hypothetical machine problem instances of size 100 in 1 minute using algorithm A, which is a O(2n). We would like to solve instances of size 200 in 1 minute using algorithm A on a new machine. What is the speed of the new machine should be?
2 Answers ABC, Qatar University,
main(){int a=5,b 10,c=2, d;a=b c;d=++a=(--c)*2; printf("%d%d%d%d,a,b,c,d; return o;}
write a program to convert temperature from fa height into celcius and vise versa,use modular programming
0 Answers Jomo Kenyatta University,
Given 1 to n random number, find top 10 maximum numbers and explain the time complexity of the algorithm.
using repetition structure. Write a c program that will accept five numbers. The program should count and output the total count of even numbers and total count of add numbers.
Write a function- oriented to convert the input dollar(s) into its equivalent peso. Assume that one dollar is equivalent to 51.60
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)
how to find out the maximum number out of the three inputs.
6 Answers ABC, Apple, C3I, HP, TCS,
What output does the following code generate? Why? What output does it generate if you make A::Foo() a pure virtual function? class A { A() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; class B : public A { B() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; int main(int, char**) { A objectA; B objectB; return 0; }
A Binary no. is given, we hav to find it's decimal equivalent.
Write a program to enter 10 number of integer entries into an array n and then odds up all the odd entries. the program then displays the result. plssss answer assss fast asss u can...
Here's the programm code: int magic(int a, int b) { return b == 0 ? a : magic(b, a % b); } int main() { int a, b; scanf("%d%d", &a, &b); printf("%d\n", magic(a, b)); return 0; } on input stream we have integers 4, 45 What's the output integer? How many times will be initiated "magic" function?