Answer:
#include<iostream>
using namespace std;
//main function
int main(){
//initialization
float a1,a2;
//display the message
cout<<"Enter the first number: ";
cin>>a1; //store the value
cout<<"Enter the second number: ";
cin>>a2; //store the value
//display the calculation result
cout<<"The sum is: "<<a1+a2<<endl;
cout<<"The Subtraction is: "<<a1-a2<<endl;
cout<<"The product is: "<<a1*a2<<endl;
cout<<"The Quotient is: "<<a1/a2<<endl;
}
Explanation:
Create the main function and declare the two variables of float but we can enter the integer as well.
display the message on the screen and then store the input enter by the user into the variable using the cin instruction.
the same process for second input as well, display the message and store the input.
after that, print the output of the calculation. the operator '+' is used to add the two numbers like a1+a2, it adds the number stored in the variable.
similarly, the subtraction operator is '-', product '*' and quotient operator '/'.
and finally, we get the desired output.
Answer:
c. 27
Explanation:
Answer:
// Application in java.
// package
import java.util.*;
// class definition
class Main
{
// method for calculating interest
public static float calculateInterest(float start_bal,float i_Rate)
{
// calculate return
float return_Amount=start_bal+(start_bal*(i_Rate/100));
// return
return return_Amount;
}
// main method of the class
public static void main (String[] args) throws java.lang.Exception
{
try{
// scanner Object to read the input
Scanner sc = new Scanner(System.in);
// variables
float start_bal;
float i_Rate=5;
// ask to enter start money
System.out.print("Enter start money:");
// read start money
start_bal=sc.nextFloat();
// call the function and print the return amount
System.out.println("5% interest earned on $" + start_bal + " after one year is $" + calculateInterest(start_bal,i_Rate));
}catch(Exception ex){
return;}
}
}
Explanation:
Declare and initialize interest rate with 5.Then read the start money from user.Then call the method calculateInterest() with parameter start_bal and i_Rate.It will calculate the return amount after 1 year.Print the returned amount in main method.
Output:
Enter start money:1500
5% interest earned on $1500.0 after one year is $1575.0
A graph or a table.
You can use a graph or a table to make the point muchstronger than just describing the data. A graph can be used to represent one ofmore sets of data graphically. A table in this case as compared to a graph isless effective because it only shows the data whereas the graph shows an interpretationof data. However, you can use a table from an excel sheer to enter raw data and make some complex andsimple calculations.
HIERARCHICAL EXAMPLE.
Many examples of hierarchical addressing exists which reduces the amount of work needed in locating or in delivering,and one of such examples is the 'sorting of books in a library'.
Looking at a library having books kept randomly on any stack and shelf,it will make it difficult finding any book easily or locating any book of a specific genre.so,to avoid such problems, books are orderly sorted in a library and each book is given or has a unique identification number.
Books that has the same or related subject are kept in the same stack and books of the same genre are also kept together.
In a library,there are many stacks having different rows.
Take for an example; If one need to find a book on computer network,the user can search for the books in stacks of books that are related to Computer Science instead of searching the whole library for the book.
So,the hierarchical addressing saves lots of work and also time required for searching a specific book in the library.
Answer:
The word used to begin a conditional statement is if.
Explanation:
In the syntaxes of most (if not all) programming languages, the word if is used to begin any conditional statement.
Take for instance:
Python:
if a == b:
print("Equal")
C++:
if(a == b)
cout<<"Equal";
Java:
if(a==b)
System.out.print("Equal")
The above code segments in Python, C++ and Java represents how conditional statements are used, and they all have a similarity, which is the "if" word
100
import java.util.Scanner;
public class ProductCalculator {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int userNumber;
userNumber = scnr.nextInt();
while(userNumber >= 40){
userNumber = userNumber * 4;
System.out.println(userNumber);
}
Java. What am I doing wrong? It's not giving an output.
}
}
Change this line;
with;
The loop will never start because userNumber is not already greater than 40.