// This command takes input from the user.
Scanner input = new Scanner(System.in);
int response= input.nextInt();
// Making the variables required
int noCount =0 ;
int yesCount =0;
// Checking the response if it is 1 or 2 and reporting accordingly
if(response == 1 || response ==2){
yesCount+=1;
System.out.println("YES WAS RECORDED");
}
// Checking if the input is 3 or 4 then printing the required lines
else if (response == 3 || response ==4){
noCount+=1;
System.out.println("NO WAS RECORDED");
}
// if the input is not valid than printing INVALID
else{
System.out.println("INVALID");
}
Answer:
num = int(input("enter a number:"))
print(num * 8)
Explanation:
num is just a variable could be named anything you want.
if code was like this num = input("enter a number:")
and do a print(num * 8)
we get an error because whatever the user puts in input comes out a string.
we cast int() around our input() function to convert from string to integer.
therefore: num = int(input("enter a number:"))
will allow us to do print(num * 8)
The primary reason that you would import data into a database is because the data already exists somewhere else.
As an example, you may have a spreadsheet that contains names and telephone numbers of a group of people. It is much faster to import this data into a database instead of manually entering the information.
Answer:
Pseudo CODE
a)
n= Input “Enter 5 integer value”
b)
sum=0.0
For loop with i ranging from 0 - 5
Inside loop sum=n[i]+sum
Outside loop avg= sum/5
Print avg
c)
small=n[0] # assume the first number in the list is smallest
large= n[0] # assume the first number in the list is largest
For loop with i ranging from 0 - 5
Inside loop if n[i]<small #if any another number is smaller than small(variable)
Inside if Then small=n[i]
Inside loop if n[i]>large # if any another number is larger than large(variable)
Inside if then large=n[i]
Print small
Print large
d)
print avg
print small
print large