Computers and Technology, 11.06.2021 01:50 dolphinkina35
LAB: Divide input integers
Write a program using integers userNum and divNum as input, and output userNum divided by divNum three times. Note: End with a newline.
Ex: If the input is:
2000 2
the output is:
1000 500 250
Note: In Java, integer division discards fractions. Ex: 6 / 4 is 1 (the 0.5 is discarded).
import java. util. Scanner;
public class LabProgram {
public static void main(String[] args) {
/* Type your code here. */
}
}
(My professor wants us to use this temple and I'm not sure how I should start typing the code were it says "type code here". I've tried differnt forms like the one provided below but they all have errors according to the program. it tells me that i have to place ; .
import java. util. Scanner;
public class LabProgram {
public static void main(String[] args) {
userNum= int(input())
divNum= int(input())
# calculating the division three times
userNum=userNum//divNum
#i have used end=' ' so that it does not produce new line
# instead of that it produce space
print(userNum, end=' ')
userNum=userNum//divNum
print(userNum, end=' ')
userNum=userNum//divNum
print(userNum, end=' ')
}
}
Errors:
Program errors displayed here
LabProgram. java:5: error: '.class' expected userNum= int(input()) ^ LabProgram. java:5: error: ';' expected userNum= int(input()) ^ LabProgram. java:6: error: '.class' expected divNum= int(input()) ^ LabProgram. java:6: error: ';' expected divNum= int(input()) ^ LabProgram. java:7: error: illegal character: '#' # calculating the division three times ^ LabProgram. java:7: error: ';' expected # calculating the division three times ^ LabProgram. java:7: error: ';' expected # calculating the division three times ^ LabProgram. java:9: error: illegal character: '#' #i have used end=' ' so that it does not produce new line ^ LabProgram. java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram. java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram. java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram. java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram. java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram. java:10: error: illegal character: '#' # instead of that it produce space ^ LabProgram. java:10: error: ';' expected # instead of that it produce space ^ LabProgram. java:10: error: ';' expected # instead of that it produce space ^ LabProgram. java:10: error: ';' expected # instead of that it produce space ^ LabProgram. java:11: error: ';' expected print(userNum, end=' ') ^ LabProgram. java:12: error: ';' expected userNum=userNum//divNum ^ LabProgram. java:13: error: ';' expected print(userNum, end=' ') ^ LabProgram. java:14: error: ';' expected userNum=userNum//divNum ^ LabProgram. java:15: error: ';' expected print(userNum, end=' ') ^ 22 errors
Answers: 1
Computers and Technology, 22.06.2019 07:00
Our primary purpouse as electricians is to do wich of the following core concepts? a: install electrical components in a way they can be upgraded b: install electrical equiptment in a way that reduces heat c: install electrical systems in a safe manner d: only b and c
Answers: 1
Computers and Technology, 23.06.2019 05:00
Which best explains why a digital leader would join a society specializing in technology
Answers: 1
Computers and Technology, 23.06.2019 05:20
What did creator markus “notch" persson initially call his game
Answers: 1
LAB: Divide input integers
Write a program using integers userNum and divNum as input, and output u...
History, 01.08.2019 01:30
Mathematics, 01.08.2019 01:30
Biology, 01.08.2019 01:30
History, 01.08.2019 01:30
Biology, 01.08.2019 01:30
Biology, 01.08.2019 01:30
Mathematics, 01.08.2019 01:30
History, 01.08.2019 01:30
Spanish, 01.08.2019 01:30