Question about Computers & Internet

Ad

/*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

In which language you want?

Posted on Aug 02, 2013

Ad

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

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

#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

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

Posted on Oct 08, 2012

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)...

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 &...

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

in the diagram "y" =yes "n" = no

Sep 10, 2012 | Borland Turbo C++ 3.0 Full Version...

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

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

create a flowchart determine whether an inputted value is negative or positive

Jul 09, 2011 | Global Marketing Partners FLOWCHARTS AND...

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

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

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 =

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

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

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

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

#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();

}

#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

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!

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

Nov 21, 2017 | The Computers & Internet

145 people viewed this question

Usually answered in minutes!

×