What is the output, if userVal is 5? int x; x = 100; if (userVal != 0) { int tmpVal; tmpVal = x / userVal; System.out.print(tmpVal); }

Answers

Answer 1
Answer:

Answer:

The output is 20

Explanation:

This line divides the value of x by userVal

tmpVal = x / userVal;

i.e.

tmpVal = 100/5

tmpVal = 20

This line then prints the value of tmpVal

System.out.print(tmpVal);

i.e 20

Hence, The output is 20

Answer 2
Answer:

Final answer:

The provided Java code checks if the variable userVal does not equal 0. As this is the case when userVal is 5, another variable tmpVal is assigned the value of another variable x (which is 100) divided by userVal. Hence, the output of the code would be 20.

Explanation:

In the given piece of code, the variable userVal is assigned a value of 5. The program also contains a variable x which is assigned a value of 100. An if statement checks whether userVal does not equal 0 - since 5 != 0, the condition is true. A new variable tmpVal is then declared and assigned the value of x divided by userVal, so tmpVal equals 100 / 5, which is 20. So, the output of this code when userVal is 5 would be 20.

Learn more about Java Programming here:

brainly.com/question/34106786

#SPJ3


Related Questions

Define the role of websites in internet.also write the importance of internet in our daily life.
3. Problem 5. A digital computer has a memory unit with 24 bits per word. The instruction set consists of 150 different operations. All instructions have an operation code part (opcode) and an address part (allowing for only one address). Each instruction is stored in one word of memory. a. How many bits are needed for the opcode? b. How many bits are left for the address part of the instruction? c. What is the maximum allowable size for memory? d. What is the largest unsigned binary number that can be accommodated in one word of memory?
A _____ area network is one step up from a _____ area network in geographical range.
(Numerical Data Representation) How many bits per word are required to represent the following positive decimal integers: a.0 through 100b.0 through 255c.0 through 256d.0 through 10,000,000
Choose the missing term-------time time.sleep(3)

Which of the following are common problems experienced with software applications? (choose all that apply)faulty microprocessor

missing DLL files

installation issues

configuration issues

applications running slowly

kernel panic

power cords not being plugged in

Answers

The common problems experienced with software applications will be missing DLL files, installation issues, configuration issues, applications running slowly, and kernel panic. Then the correct options are B, C, D, E, and F.

What are the common problems experienced with software applications?

Today's world depends heavily on technology. Technology now controls not just how businesses run but also how quickly many different sectors across the world are developing. The pace of technical development dictates the rate of development and company growth, leaving human progress and economic expansion at the whim of technology.

Some of the common problems are as follows:

  • Missing DLL files
  • Installation issues
  • Configuration issues
  • Applications running slowly
  • Kernel panic

The normal issues experienced with programming applications will be missing DLL documents, establishment issues, arrangement issues, applications running gradually, and part alarms. Then the right choices are B, C, D, E, and F.

More about the common problems with software applications link is given below.

brainly.com/question/29704760

#SPJ12

Answer:

All but the top and bottom on edge 2020

Explanation:

In C++, write a program that asks the user to input an integer and then calls a function namedmultiplicationTable(), which displays the results of multiplying the integer by each
of the numbers 2 through 10.

Answers

Answer:

//Program in C++.

// header

#include <bits/stdc++.h>

using namespace std;

// function to multiply number with 2-10

void multiplicationTable(int num)

{

   cout<<"Number when multiplied with 2-10:"<<endl;

   for(int a=2;a<=10;a++)

   {

   // multiply number with 2-10

      cout << num << " * " << a << " = " << num*a << endl;

   }

}

// driver function

int main()

{

// variable

   int num;

   cout<<"Enter a number:";

   // read number from user

   cin>>num;

   // call the function

   multiplicationTable(num);

return 0;

}

Explanation:

Read a number from user and assign it to variable "num".Call the function  multiplicationTable() with parameter "num".In this function, multiply number  with each from 2 to 10 and print the value.

Output:

Enter a number:5                                                                                                          

Number when multiplied with 2-10:                                                                                          

5 * 2 = 10                                                                                                                

5 * 3 = 15                                                                                                                

5 * 4 = 20                                                                                                                

5 * 5 = 25                                                                                                                

5 * 6 = 30                                                                                                                

5 * 7 = 35                                                                                                                

5 * 8 = 40                                                                                                                

5 * 9 = 45                                                                                                                

5 * 10 = 50

A database is composed of several parts known as database ____

Answers

fragments.....is the answer...
Hope it Helpz..!!

.Although SQL is a language, you donât use it to write applications? (true, false)

Answers

Answer:

True

Explanation:

SQL stands for structured  query language , which is used to query Relational Database Management systems like SQLServer. This is not for writing applications like business layer where we use some programming languages.SQL is meant for data layer to perform CRUD operations against database.

CRUD operations :

Create

Read

Update

Delete

we can perform above operations on database by using SQL query language

your manager ask you to set up a secure network connection at a remote site which protocol would you use

Answers

Answer:

Remote Access Protocols

Explanation:

Considering the situation above, the most appropriate protocol to use is known as the Remote Access Protocol.

This is because Remote Access Protocol is a combination of techniques and sets of instructions that are used in managing the connection between a remote access server and a remote computer. For example, some of the Remote Access Protocols that can be used are Serial Line Internet Protocol, Point-to-Point Protocol, Point-to-Point Protocol over Ethernet, etc.

Hence, given that a trusted Remote Access Protocol allows people to access a steady, secure connection between desktop sharing and remote access for help desk activities.

Therefore, the Remote Access Protocol can be utilized in setting up a secure network connection at a remote site

Write a program which promptsuser to enter an integer value. Using while loop print the valuesfromzero up to the number enteredby the user.

• Enlist the odd numbers out of them

• Enlist the prime numbers out of odd number list and printtheir sum (add all the prime numbers)

Answers

Answer:Following is the c++ code for the problem:

#include <iostream>

using namespace std;

int main() {

   int number;

   cout<<"Enter the number"<<endl;

   cin>>number;

   int i=0,c=0,odd[500];

   while(i<=number)//loop for printing the numbers form 0 to number.

   {

       cout<<i<<" ";

       if(i%2!=0)// storing in the odd array if the number is odd.

       {

           odd[c++]=i;//storing odd numbers..

       }

       i++;

   }

   cout<<endl;

   i=0;

   cout<<"The odd numbers are "<<endl;

   while(i<c)//loop to print the odd numbers.

   {

       cout<<odd[i]<<" ";

       i++;

   }

   cout<<endl<<"The prime numbers are "<<endl;

   i=0;

   int sum=0;

   

   while(i<c)//loop to print the prime numbers..

   {

       int div=2;

       while(div<odd[i])

       {

           if(odd[i]%div==0)

           break;

           div++;

       }

       if(div==odd[i])

      {

           cout<<odd[i]<<" ";

           sum+=odd[i];//updating the sum..

      }

       i++;

   }

   cout<<endl<<"The sum of odd prime numbers is "<<sum<<endl;//printing the sum..

return 0;

}

Output :

Enter the number

49

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  

The odd numbers are  

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49  

The prime numbers are  

3 5 7 11 13 17 19 23 29 31 37 41 43 47  

The sum of odd prime numbers is 326.

Explanation:

First I have printed the values from 0 to n and i have taken an array to store odd numbers.After that i have printed the odd values.And after that i have printed prime numbers among the odd numbers and their sum.These all operations are done using while loop.