Question about Computers & Internet

1 Answer

Read n & m, display the sum of all the even and odd numbers between n to m.

Sample output
enter 1st no:3
enter 2nd no:
sum of even nos:10
sum of odd nos:12

Posted by on

Ad

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    MVP:

    An expert that gotĀ 5 achievements.

    Governor:

    An expert whose answer gotĀ voted for 20 times.

    Scholar:

    An expert who has written 20 answers of more than 400 characters.

  • Expert
  • 148 Answers

#include <stdio.h>

int main()
{
int n1, n2, i;
int sum = 0;
n1 = 3;
n2 = 11;

for (i = n1; i <= n2; i++) {
if (i % 2 == 0) {
printf("Adding %d\n", i);
sum = sum + i;
}
}
printf("sum = %d\n", sum);
return 0;
}

Posted on Feb 21, 2008

Ad

1 Suggested Answer

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.
the service is completely free and covers almost anything you can think of.(from cars to computers, handyman, and even drones)
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

Ad

Add Your Answer

Uploading: 0%

my-video-file.mp4

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

×

Loading...
Loading...

Related Questions:

1 Answer

How can i display an even number if i enter an odd number in visual basic 6.0


To display an even number when an odd number is entered you can add 1.
n= val(text1.text) 'Take the value of n from the textbox.
If n mod 2 =1 then 'If n is an odd number n=n+1 'You make it an even number end if
text2.text = n 'Display it in another textbox.

Please give a good rating to this answer so that I will be encouraged to support people like you having problems with VB6.

Sep 22, 2011 | Computers & Internet

1 Answer

How do I put my calculator in statistics mode?


The TI-30XA does not have to be switched to a statistics mode, the operations are available all the time. The choice of operations are somewhat limited; the calculator offers statistics functions for one dimensional data sets only (no linear interpolation of (x,y) value pairs, for example):
  • [2nd] [CSR] - erase statistics data
  • [mib8888_17.gif] - add a number to the sample set
  • [2nd] [mib8888_18.gif] - remove a number from the sample set
  • [2nd] [FRQ] - multiple entry of the same sample value
  • [2nd] [n] - sample set size
  • [2nd] [mib8888_19.gif] - sum of all sample elements
  • [2nd] [mib8888_20.gif] - sum of the squares of all sample elements
  • [2nd] [mib8888_21.gif] - average of the sample set
  • [2nd] [mib8888_22.gif] - standard deviation (sample set is a complete set)
  • [2nd] [mib8888_23.gif] - standard deviation (sample set is a subset of a larger set)
The calculator displays "STAT" if the current sample set is non-empty.

Example: calculate the average and standard deviation of the set { 3, 4, 5, 5, 5, 5, 6 }.
  1. [2nd] [CSR] - erase stat memory
  2. 3 [mib8888_17.gif] 4 [mib8888_17.gif] 5 [2nd] [FRQ] 4 [mib8888_17.gif] 6 [mib8888_17.gif] - enter the data, note the use of [2nd] [FRQ] to enter the four occurrences of "5". Entering 5 [mib8888_17.gif] four times would have done the same.
  3. [2nd] [mib8888_21.gif] - display the average of the set, (4.714...)
  4. [2nd] [mib8888_22.gif] - display the standard deviation of the set (0.8806...)

Jan 25, 2011 | Texas Instruments TI-30XA Calculator

1 Answer

Out of 1,3,5,7,9,11,13,15,17,19 pick up any 5 nos. to make a total of 50.


Several ways to do this. 1, 5, 13, 15 17 is one of them.

(1 x 5) + 13 + 15 + 17

Workings:

(1 x 5) = 5

5 + 13 + 15 + 17 = 50.

- You cannot add five odd numbers together to make 50. Five odd numbers added together will always be an odd number.
- You cannot add four odd and take an odd number away as this will also total an odd number.

Therefore 2 of the numbers must be multiplied as this enables you to effectively add four odd numbers together to total an even number.

Hope this helps. Got any more?

Jan 13, 2011 | Vacuums

1 Answer

Double Squares A double-square number is an integer X which can be expressed as the sum of two perfect squares. For example, 10 is a double-square because 10 = 32 + 12. Your task in this problem is, given...


20 1105 1991891221 510644794 3 0 421330820 4 65 1941554117 2147483645 801125 1000582589 27625 1048039120 1022907856 2147483646 1041493518 1096354453 1740798996 71825

Jan 08, 2011 | Starrett 50118 14d Complete Double Square

2 Answers

Can i do statistics on the casio fx-115 es? and how can i use it?


Yes and here is how to do 1-var statistics and 2-var statistics. Please read the whole post. I assume you know the theory. I will show you the key strokes

For 1-Var statistics
Press [MODE][3:STAT] [1:1-VAR]. You are ready to enter values in the X column.
Enter a number and press [=]. Cursor jumps to second number to enter.
Keep entering numbers and pressing [=] till all numbers are in. Press the [=] key after the last one.
Press [AC] key to clear the screen.
Press [SHIFT] [STAT] (above digit 1.) then [5:Var]. Screen displays the statistical variables 1:n ;2: x bar; 3: x sigma n; 4:x sigma n-1.
Press the number corresponding to the statistical value you want, ex 1:n . The variable appears on screen. Press [=] and it will be displayed.
To display another variable press [SHIFT][STAT][5:Var][ 1,2, 3, or 4] .

To access the sum of squares sigma x^2 and the sum of data sigma x press[SHIFT][STAT][4:SUM] then [1: for sigma x^2] or [2: for sigma x]. Press [SHIFT][STAT][6:MinMax] to access minX and maxX.

For 2-var statistics
To perform 2 variable statistics you press [MODE][3:STAT] and any of the other regression options (except 1:1-Var). A two column template opens where you enter the X and Y values. When finished entering data, press [SHIFT][STAT][5:Var]. to access the different statistics. As I assumed above, you should be able to recognize what each variable means.

Nov 06, 2010 | Casio FX-115ES Scientific Calculator

1 Answer

How do I get the variance, the standard deviation, and the sample standard deviation in a casio FX-115Es.. Thank you


The variance is the square of the standard variation

TO COMPUTE STANDARD DEVIATION AND 2-VAR STATISTICS.

I assume you know the theory. I will show you the key strokes

for 1-Var statistics
Press [MODE][3:STAT] [1:1-VAR]. You are ready to enter values in the X column.
Enter a number and press [=]. Cursor jumps to second number to enter.
Keep entering numbers and pressing [=] till all numbers are in. Press the [=] key after the last one.
Press [AC] key to clear the screen.
Press [SHIFT] [STAT] (above digit 1.) then [5:Var]. Screen displays the statistical variables 1:n ;2: x bar; 3: x sigma n; 4:x sigma n-1.
Press the number corresponding to the statistical value you want, ex 1:n . The variable appears on screen. Press [=] and it will be displayed.
To display another variable press [SHIFT][STAT][5:Var][ 1,2, 3, or 4] .

To access the sum of squares sigma x^2 and the sum of data sigma x press[SHIFT][STAT][4:SUM] then [1: for sigma x^2] or [2: for sigma x]. Press [SHIFT][STAT][6:MinMax] to access minX and maxX.

For 2-var statistics
To perform 2 variable statistics you press [MODE][3:STAT] and any of the other regression options (except 1:1-Var). A two column template opens where you enter the X and Y values. When finished entering data, press [SHIFT][STAT][5:Var]. to access the different statistics. As I assumed above, you should be able to recognize what each variable means.

Oct 27, 2010 | Casio FX-115ES Scientific Calculator

3 Answers

9999555533331111 out of these numbers any 6 numbers total is 21? how


this would be explained on the basis of two FACTS below.......
sum of two odd numbers are always even and
sum of to even numbers are also always even

then how 6 odd numbers (consider 3 pairs, 9 5 3 1 being odd numbers) can make an odd number 21..!!
SO SIMPLE
Make your basics strong...


Aug 14, 2010 | Computers & Internet

1 Answer

Where can i find an example program of visual basic that can input an odd and even number and can display the result of highest even and highest odd number and can sort them from minimum to maximum


http://www.microsoft.com/visualstudio/en-us/products/teamsystem/default.mspx?pt_id=-1&WT.mc_id=B66C779D-0907-4EE1-9435-FED85F10C8E2&WT.srch=1&wt.mc_id=vspdsrch
this site has a free sample download

Apr 16, 2009 | Microsoft Visual Basic Professional...

2 Answers

How to sum series


Click on the Mode button twice until you see “SD”. Select 1. This puts the calculator in Statistics Mode. image001.gif Enter the first number, 1.
image001.gif Hit the M+. (n= 1 will appear in the window)
image001.gif Enter the second number, 1.
image001.gif Hit the M+ key. (n=2 will appear in the window)
image001.gif . . . . .
image001.gif Enter the last number, 7.
image001.gif Hit the M+ key. (n=7 will appear in the window)
image001.gif Hit shift, 2. (This invokes the S-Var option.)
image001.gif Hit 1 for the sample mean. Hit Enter.
image001.gif Hit 3 for the sample standard deviation that we will use in class. Hit Enter. here you can also ffind the sum of all numbers

Jan 21, 2009 | Casio FX-300MS Calculator

1 Answer

Pls. help me


Q.2#  Dim n, sum as Double
Dim i as Integer
n=100
sum=0

for i=1 to n
sum=sum+1/n
next i

Q.3#  Dim sum as Double
sum=0
for i=1 to 99
if i%2 <> 0 then sum=sum+i end if
next i

Sep 16, 2008 | Microsoft AccRepair DS2 2004 for Fr...

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

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