Row of numbers
My progam uses to calculate the average of all the numbers. The numbers are entered until it equal 0.
This is the code
public class rowNumber
{ public static void main(String args[])
{ int n[],i=0,count;
float sum,avr;
BufferedReader inStream=new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Enter a number:");
String in=inStream.readLine();
n=Integer.parseInt(in);
while(n[i]!=0)
{ System.out.println("Enter a number:");
String in=inStream.readLine();
i++;
n[i]=Integer.parseInt(in);
count=i;
for(i=0;i<n;i++)
sum+=n[i];
avr=sum/count;
System.out.println("Average of all numbers= "+avr);
}But when run this program, it has many error. Please help me! Thanks a lot!
I change my program like this:
public class rowNumber
{ public static void main(String args[])
{ int n[],i=0,count;
float sum,avr;
BufferedReader inStream=new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Enter a number:");
String in=inStream.readLine();
n=Integer.parseInt(in);
while(n[i]!=0)
{ System.out.println("Enter a number:");
String in=inStream.readLine();
i++;
n[i]=Integer.parseInt(in);
count=i;
for(i=0;i<n;i++)
sum+=n[i];
avr=sum/count;
System.out.println("Average of all numbers= "+avr);
}And there are 5 errors:
rowNumber.java:5: cannot find symbol
symbol : class BufferedReader
location: class rowNumber
BufferedReader inStream=new BufferedReader(new
^
rowNumber.java:5: cannot find symbol
symbol : class BufferedReader
location: class rowNumber
BufferedReader inStream=new BufferedReader(new
^
rowNumber.java:7: cannot find symbol
symbol : class InputStreamReader
location: class rowNumber
InputStreamReader(System.in));
^
rowNumber.java:13: in is already defined in main(java.lang.String[])
String in=inStream.readLine();
^
rowNumber.java:18: operator < cannot be applied to int,int[]
for(i=0;i<n;i++)
^
5 errors
Similar Messages
-
How do I add multiple rows in Numbers for iPad?
how do I add multiple rows in Numbers for iPad?
Hi James,
On the iPod I can only insert what is on the clipboard but I can insert however many rows I have there. Is it working differently for you? Benjoon seemed to think that he could not do this in Numbers. He was ruling Numbers out because of it. He doesn't need to do that because of this issue.
If I was needing to insert multiple blank rows often I might keep a table of blank rows or just some blank rows at the end of the working table that I could copy/paste. This is no different than Numbers on the Mac.
quinn -
Hi,
how can I add a row above a certain row in Numbers? I'm trying to insert a row right at the top of my table.
Thanks
p.Tap on the table to expose the selector controls. Tap on the row at the far left (on the control bar to left of the first cell. You should se a menu pop up. tap Insert. If this is done at the first row, you should have the option of selecting a body or header row.
you also might find this helpful: http://help.apple.com/numbers/ipad/2.0/ -
How to make numbered rows in Numbers
How do I make numbered rows in Numbers?
Hi Carol,
It depends on whether you want the numbers to move with the rows if and when you sort, or if you always want the rows numbered top to bottom.
There's a function that returns the row number: ROW(). Placing that in a cell always displays the number of the row. If you want to number once and then let the numnbers follow the data around, you can Fill with a sequence by typing "1" in the first row and "2" in the second row. Then select both cells and drag the Fill handle down the table to extend the series. The fill handle is the little open circle in the lower right corner of the selection.
Jerry -
How do I export a specific set of rows from Numbers?
What i am looking to be able to do is
Export a specific set of rows from Numbers
I am working with large files of information
but would like to break the file up into smaller files
for example
I have 1 file with 40,000 rows
I need to be able to export/save this file into 4 smaller files
Rows 1-10,000
Rows 10,001-20,000
Rows 20,001-30,000
Rows 30,001-40,000I do not think I would use Numbers for this task.
I would duplicate the file (let's say the name is data.txt)
and name the two files:
dataA.txt
dataC.txt
then I would open dataA.txt in TextEdit and delete the last half of the file and save
then I would open dataC.txt in TextEdit and delete the first half of the file and save
then duplicate dataA.txt and name the new file dataB.txt
then duplicate dataC.txt and name the new file dataD.txt
Now open dataA.txt and delete the last half of the file, save
Now open dataB.txt and delete the first half of the file, save
Now open dataC.txt and delete the last half of the file, save
Now open dataD.txt and delete the first half of the file, save
if you did this very often I would suggest a script of some kind -
How do I automatically number rows in Numbers for iPad?
How do I automatically number rows in Numbers for iPad?
Hi James,
On the iPod I can only insert what is on the clipboard but I can insert however many rows I have there. Is it working differently for you? Benjoon seemed to think that he could not do this in Numbers. He was ruling Numbers out because of it. He doesn't need to do that because of this issue.
If I was needing to insert multiple blank rows often I might keep a table of blank rows or just some blank rows at the end of the working table that I could copy/paste. This is no different than Numbers on the Mac.
quinn -
How do I delete rows in Numbers for iPad?
I am new to numbers for iPad. How do I delete rows in Numbers for iPad? I am able to delete the data in the rows/cells but I can't delete/move up the rows so I can move data in it's place.
I havn't got Numbers so I can't check it, but is what is on this page any help http://help.apple.com/numbers/ipad/1.4/#tan72717a35 ?
-
Hiding rows in Numbers for iPad - any update?
Several months ago, I asked the question 'how do I hide rows in Numbers for iPad' and the answer was that it's not possible,
Has there been any change?
Also, is it possible yet to show the row/column grid numbers/letters?I havn't got Numbers so I can't check it, but is what is on this page any help http://help.apple.com/numbers/ipad/1.4/#tan72717a35 ?
-
Remove Duplicate Rows in Numbers 09
Is there a way to remove duplicate rows in Numbers 09? For example I have 2 Tables and the values of Column A are mainly the same, but there are definitely a few dozen unique values in 1 table which are not in table 2 and visa versa. I'd like to make a new table with a column A with all of the values, but with duplicates removed so that I can then compare the values of a different column based on the value of Column A for each table.
I copied tabeau 1 and tableau 2 in tableau 3 then in cell E2 of tableau 3 I entered the formula:
=COUNTIF($A$1:$A1,"="&A)
Using fillDown, I filled the column E
I get 0 if the cell a is unique
I get 1 (or higher) if the cell is available several times.
Sort upon column E
delete the rows whose cell E is not 0.
Yvan KOENIG (VALLAURIS, France.) samedi 22 août 2009 11:08:15 -
How to repeat rows in numbers on every page
how to repeat rows in numbers on every page
Hi mitesh hirani,
Welcome to Apple Support Communities.
Do you mean repeat Header Rows for tables?
Menu > Print... > Print Setup (the panel on the right) > Repeat Table Headers
Regards,
Ian. -
Transpose columns and rows in numbers
I need to transpose columns and rows in Numbers and I do not want to write script to do it. Is there an easier way?
Give me a proper transpose and I will uninstall Excel and never look back.
Ok, here's a proper transpose, that can be placed in an Automator Service so it becomes a simple menu pick as below (and can also be assigned a keyboard shortcut).
To use it (this is slightly different from Excel) you select the range you want to transpose, choose Copy Transpose, click a destination cell in an existing table in the current document or another document, and command-v (Edit > Paste) or option-shift-command-v (Edit > Paste and Match Style).
The one-time setup is as follows. In Automator choose File > New > Service, drag a Run AppleScript action from the left into the right pane, choose 'No Input' for 'Services receives selected' and 'Numbers' for 'in'. Then paste the following into the Run AppleScript action, replacing all text already there by default:
--Transpose - select range, run, paste transposed values where wanted
try
tell application "Numbers" to tell front document to tell active sheet
set selected_table to first table whose class of selection range is range
tell selected_table
set my_selection to the selection range
set first_col to address of first column of my_selection
set last_col to address of last column of my_selection
set first_row to address of first row of my_selection
set last_row to address of last row of my_selection
set str to ""
repeat with i from first_col to last_col
repeat with j from first_row to last_row
set str to str & (value of cell j of column i of selected_table) & tab
end repeat
set str to str & return -- add line return after row
end repeat
end tell
end tell
set the clipboard to str
display notification "Ready to paste transposed values" with title "Numbers"
on error
display dialog "Select a range first and then try again"
end try
--end script
Hit the compile "hammer" and the script should indent properly. Then save the service with the name you want to appear in your menu, and it will thereafter be available via the Services menu (and keyboard shortcut, if you set one up in System Preferences > Keyboard > Shortcuts > Services).
That's it. Less then five minutes' one-time set-up work and you've got a menu pick for a transpose functionality that is as convenient as Excel's.
SG -
Transpose a column to a row in Numbers for IOS
I want to transpose a column to a row in Numbers for IOS, and none of the usual formulas are working. Any thought?
In Numbers '09 (the current Mac OS X version) the formula below will transpose rows and columns. The transposition is to a second table, and transposes entered data and the results of formulas.
=OFFSET(Table 1::$A$1,COLUMN()-1,ROW()-1)
If this solution does not work in Numbers for iOS, I'd suggest reposting in the iWork for iOS community. This area is for Numbers for Mac OS X topics.
Regards,
Barry -
How do you delete more than one row on numbers?
how do you delete more than one row on numbers?
Hi operatorcarmax,
Select the Rows (shift click works for me). Then hover the cursor over any selected Row label to see the upside-down triangle. Click on it to see a Pop-up menu.
The Numbers User Guide is available for download under the Numbers Help Menu. A good read.
Regards,
Ian. -
I can no longer drag rows in Numbers. I was able to do this until very recently.
When I click on the number on the left hand side of the row, nothing happens. I used to be able to do this and then drag the row. Any suggestions?Sorry for not providing enough info with the initial post.
I can edit the document in most ways. I can resize rows and columns and do eveyrthing inside of cells.
When I click on the number at the left-hand side of the row, I can get the drop-down menu, but I can't move the row at all. I don't think I can move individual cells, either.
I just tried to move other rows in a different Numbers spreadsheet and I can not.
I'm not sure how to attach a screenshot. -
I want to average a row of numbers, but some of the cells are empty. I want the empty cells to be considered null - not included in the averaging calculation. Is there a way to do this? I am using Numbers '08.
Hi milkmaid,
I am using Numbers '09 and I assume that the AVERAGE() function is the same in Numbers '08.
AVERAGE() ignores cells that are blank, or contain text.
In this screen shot, all the cells with yellow fill contain a formula to average all the cells to their left.
In Row 2, Cell D2 contains the formula
=AVERAGE(A2:C2)
In Row 3, Cell E3 contains the formula
=AVERAGE(A3:D3) and the blank cell in C3 is ignored ("null")
In Row 4, Cell E4 contains the formula
=AVERAGE(A4:D4) and the cell containing text is ignored.
Try out these three scenarious and see if they work in Numbers '08.
I don't know if Numbers '08 has a function browser. I do not have a copy of a User Guide for '08. Try the Help Menu.
Regards,
Ian. -
Sort selected rows using Numbers on an iPad
I am new to Numbers. I have spreedsheets in iCloud. On my MacBook I have figured out how to sort just "selected rows", but have not been as lucky on the same spreedsheet accessed on my iPad. If I select the rows on Numbers on the iPad the "sort" option does not appear. If I hit the block above the column it will ask how you want to sort, but this sorts the whole table/spreedsheet. Is there a way in Numbers using an iPad where you can just "sort selected rows", like on the MacBook?
Sort is only available for columns in Pages for iOS.
Maybe you are looking for
-
Looking for a new soundcard that allows use of mic and headphone connections on front of c
Hello, I'm looking for a new soundcard to replace my on-board sound. My case, Antec P80, has two jacks on the front that allows me to connect a mic and a set of headphones... Are there any soundblaster products that will allow me to use these two jac
-
Error while downloading the file
Hi, I have created a rssfeed file when i connect to iTunes and use my local webserver to look up the feed file it downloads all the episodes without any issues. From the main webserver the feed file does not work,although the paths and everything is
-
Adobe Premiere Elements 11 file saving
I have installed Adobe Premiere Elements 11 onto my C drive. When I edit video files I know they are large so that is why I save them to my D drive that is very large. Even though I save my video files and finished files to my D drive Files are stil
-
ABAP OO Doubt - validate call method.
Hi experts I'm beginer in ABAP OO and i created this code : output-cep = ch_adrc_struc-post_code1. TRY. CREATE OBJECT lr_cep. CATCH cx_ai_system_fault . ENDTRY. TRY.
-
Hi Friends, In the code .... I am calling Remote Function module ZRFC_PO_VEND_VALID using java connector and passing PO_Number and Vendor Number as input parameters and after execution it returns (E_POVALID =1 [PO_NUMBER exists for Vendor number] oth