Question about Computers & Internet

2 Answers

Write a program that will accept 20 numbers and will display the average of all positive numbers and all negative number.

Posted by on

Ad

2 Answers

  • Level 1:

    An expert who has achieved level 1.

    Corporal:

    An expert that hasĀ over 10 points.

    Mayor:

    An expert whose answer gotĀ voted for 2 times.

    Problem Solver:

    An expert who has answered 5 questions.

  • Contributor
  • 11 Answers

/*The average of all positive numbers and all negative number*/
#include"conio.h"
#include"stdio.h"

main(){
int x[20],sum1=0,sum2=0,ave1,ave2,k=0,p=0,i;

printf("Enter the number");
for(i=0;i<=19;i++)
scanf("%d",&x[i]);

for(i=0;i<=19;i++)

if(x[i]<=0) {
k++;
sum1=sum1+x[i];
ave1=sum1/k; }

else {
p++;
sum2=sum2+x[i];
ave2=sum2/p;
}

printf("ave_neg=%d",ave1);
printf("ave_pog=%d",ave2);
getch();
}

Posted on Aug 06, 2013

Ad
  • Level 1:

    An expert who has achieved level 1.

  • Contributor
  • 1 Answer

In which language you want?

Posted on Aug 02, 2013

Ad

4 Suggested Answers

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
Best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
New users get 2 Free calls (no credit card required) and instant help on almost anything you can think of (from cars to computers, appliances, handyman, and even pets).
click here to download the app (for users in the US for now) and get all the help you need.
Goodluck!

Posted on Jan 02, 2017

leakim
  • 23 Answers

SOURCE: c++ problem

I guess this can be done quite easily with stl sort function:
http://www.sgi.com/tech/stl/sort.html
You can also code a sorting algorithm like quicksort or bubblesort yourself. This is quite fun!

Posted on Dec 19, 2008

  • 68 Answers

SOURCE: c# code wite a program to accept a number from the user and display all the prime numbers fro zero up to the numbers entered by user?

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,rem,prime,primchk=1,chk;
clrscr();
printf("\nEnter the limit\n");
scanf("%d",&n);
printf("\n\n\nThe prime numbers are\n");
printf("\n2\t3\t");
for(primchk=1;primchk<=n;primchk++)
{
for(i=2;i<primchk;i++)
{
if(primchk%i==0)
{
chk=1;
chk=0;
break;
}
if(i==primchk-1)
{
if(chk==0)
{
printf("%d\t",primchk);
chk=0;
}
}
}
}
getch();
}

Posted on May 21, 2009

  • 151 Answers

SOURCE: draw flow chart to accept a 20 number from the user and display the number of odd and even

in the diagram "y" =yes "n" = no
10_8_2012_6_49_56_am.png

Posted on Oct 08, 2012

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

How many pairs of whole numbers have a sum of 40?


That depends on your definition of "whole numbers."
In the positive integers, there are twenty pairs: (1, 39), (2, 38), ... (20, 20).
If you allow zero, add (0, 40).
If you allow negative numbers, there are an infinite number of pairs:
(-1, 41), (-2, 42), (-3, 43)...

Sep 17, 2014 | The Learning Company Achieve! Math &...

1 Answer

Write a program c that declares an array of 100 elements to hold these values. Read the values in from the file and store them in successive elements of the array. Keep track of how many numbers are read...


That appears to be an intermediate question in a programming class. Best read the book, the answer is not what is important the process of getting the answer is what you are trying to learn.

May 17, 2017 | Office Equipment & Supplies

2 Answers

Flowchart that will display the positive or negative number


input a number and check whether the number is positive or negative?

Jun 28, 2012 | Global Marketing Partners FLOWCHARTS AND...

2 Answers

Write a program that accepts two numbers a and b and divides a by b and displays the quotient and the remainder..


BASIC

a = 0
b = 0
c = 0
input "First number "; a
input "Second number "; b
c = int ( a / b )
d = ( a / b ) - c
print "Quotient: "; c
print "Remainder: "; d
end

Dec 11, 2010 | Computers & Internet

1 Answer

I am having issues performing a simple function on my TI-30XS calculator. when I square a negative number - I get a negative number as opposed to a positive number?? example -3 - which I specify the...


You're not calculating the square of a negative number, you're calculating the negative of a square. You need to use parenthesis to indicate the square of a negative number.

You're calculating -(3^2), not (-3)^2.

To calculate the latter: ( (-) 3 ) x^2 =

Dec 05, 2010 | Texas Instruments TI-30XA Calculator

2 Answers

How do I get this calculator to substract


Big calculators work a little different than handheld calculators. Like the above commentor explained, if you have a basic "whats 100 minus 20?" You have to entered as 100 + 20 -- And when you hit the minus button at the end, it will give you the total. 100 is the positive number, and the 20 is the negative number that your subtracting. Also you can hit 20 -- 100 + and get the same total because you entering 20 as the negative and 100 as the positive, just in reverse.

Jul 27, 2009 | Casio HR-100TEPlus Calculator

1 Answer

C# code wite a program to accept a number from the user and display all the prime numbers fro zero up to the numbers entered by user?


#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,rem,prime,primchk=1,chk;
clrscr();
printf("\nEnter the limit\n");
scanf("%d",&n);
printf("\n\n\nThe prime numbers are\n");
printf("\n2\t3\t");
for(primchk=1;primchk<=n;primchk++)
{
for(i=2;i<primchk;i++)
{
if(primchk%i==0)
{
chk=1;
chk=0;
break;
}
if(i==primchk-1)
{
if(chk==0)
{
printf("%d\t",primchk);
chk=0;
}
}
}
}
getch();
}

May 20, 2009 | Computers & Internet

1 Answer

C++ problem


I guess this can be done quite easily with stl sort function:
http://www.sgi.com/tech/stl/sort.html
You can also code a sorting algorithm like quicksort or bubblesort yourself. This is quite fun!

Nov 28, 2008 | Computers & Internet

Not finding what you are looking for?

Open Questions:

Computers & Internet Logo

Related Topics:

145 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Doctor PC
Doctor PC

Level 3 Expert

7733 Answers

kakima

Level 3 Expert

102366 Answers

David Payne
David Payne

Level 3 Expert

14161 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...