1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Mashutka [201]
1 year ago
10

Write a program that prompts the user for two numbers then outputs the result of dividing the first number by the second number

Computers and Technology
1 answer:
Rainbow [258]1 year ago
5 0

The program is

num = int(input("Enter Numerator "))

den = int(input("Enter Denominator "))

print("quotient is ",str(num//den)," remainder is ", str(num%den))

<h3>How to create a division sign in HTML?</h3>

To create a division sign ( ÷ ) in HTML you can use any of the following codes.

&divide;

&div;

&#247;

<h3>How to divide in computer programming?</h3>

Perl code

use strict;

my $first = 15;

my $second = 5;

my $answer = $first / $second;

print "You get $answer if you divide $first by $second";

When the script above is run, it displays "You get 3 if you divide 15 by 5" on the screen.

To learn more about programming, refer

https://brainly.ph/question/4743

#SPJ4

You might be interested in
An exclusion contract A. gives a firm the right to be the exclusive provider of a good in a particular market. B. is a form of e
irina1246 [14]

Answer:

D. All of the above

7 0
2 years ago
WEP (Wired Equivalent Privacy) has a design flaw which allowed attackers to break its encryption codes, WPA2 ( 2) has not suffer
ad-work [718]

Answer:

The answer is "True"

Explanation:

In computer science, the IEEE project uses this security project, it is designed for wireless network, that provides the same level security and the data encryption for cable network also.

  • It provides protects in wireless transmissions from both the poking and collecting information of packets.  
  • It also lets hackers crack their computer, that's why the given statement is true.
3 0
3 years ago
Write a function that returns a chessboard pattern ("B" for black squares, "W" for white squares). The function takes a number N
Kryger [21]

Answer:

Here is the C++ program.

#include <iostream>  //to use input output functions

using namespace std;  // to access objects like cin cout

 

void chessboard(int N){  // function that takes a number N as parameter generates corresponding board

   int i, j;  

   string black = "B";  // B for black squares

   string white = "W"; // W for white squares

   for(i=1;i<=N;i++){  //iterates through each column of the board

       for(j=1;j<=N;j++){  //iterates through each row of the board

           if((i+j)%2==0)  // if sum of i and j is completely divisible by 2

               cout<<black<<" ";  //displays B when above if condition is true

           else  //if (i+j)%2 is not equal to 0

           cout<<white<<" ";  }  // displays W when above if condition is false

      cout<<endl;    }    }  //prints the new line

       

int main(){    //start of the main function

   int num;  //declares an integer num

   cout << "Enter an integer representing the size of the chessboard: ";  //prompts user to enter size of chess board

   cin >> num;  //reads value of num from user

   chessboard(num); } //calls chessboard function to display N lines consist of N space-separated characters representing the chessboard pattern

Explanation:

The function works as follows:

Lets say that N = 2

two string variables black and white are declared. The value of black is set to "B" and value of white is set to "W" to return a chessboard pattern in B and W squares.

The outer loop for(i=1;i<=N;i++) iterates through each column of the chess board. The inner loop  for(j=1;j<=N;j++) iterates through each row of chess board.

At first iteration of outer loop:

N = 2

outer loop:

i=1

i<=N is true because i=1 and 1<=2

So the program enters the body of the outer for loop. It has an inner for loop:

for(j=1;j<=N;j++)

At first iteration of inner loop:

j = 1

j<=N is true because j=1 and 1<=2

So the program enters the body of the inner for loop. It has an if statement:

if((i+j)%2==0) this statement works as:

if(1+1) % 2 == 0

(1+1 )% 2 takes the mod of 1+1 with 2 which gives the remainder of the division.

2%2 As 2 is completely divisible by 2 so 2%2 == 0

Hence the if condition evaluates to true. So the statement in if part executes:

cout<<black<<" ";

This prints B on the output screen with a space.

B

The value of j is incremented to 1.

j = 2

At second iteration of inner loop:

j = 2

j<=N is true because j=2 and 2=2

So the program enters the body of the inner for loop. It has an if statement:

if((i+j)%2==0) this statement works as:

if(1+2) % 2 == 0

(1+2 )% 2 takes the mod of 1+2 with 2 which gives the remainder of the division.

3%2 As 3 is not completely divisible by 2

Hence the if condition evaluates to false. So the statement in else part executes:

cout<<white<<" ";

This prints W on the output screen with a space.

B W

The value of j is incremented to 1.

j = 3

Now  

j<=N is false because j=3 and 3>2

So the loop breaks and program moves to the outer loop to iterate through the next row.

At second iteration of outer loop:

N = 2

outer loop:

i=2

i<=N is true because i=2 and 2 = 2

So the program enters the body of the outer for loop. It has an inner for loop:

for(j=1;j<=N;j++)

At first iteration of inner loop:

j = 1

j<=N is true because j=1 and 1<=2

So the program enters the body of the inner for loop. It has an if statement:

if((i+j)%2==0) this statement works as:

if(2+1) % 2 == 0

(2+1 )% 2 takes the mod of 2+1 with 2 which gives the remainder of the division.

3%2 As 3 is not completely divisible by 2

Hence the if condition evaluates to false. So the statement in else part executes:

cout<<white<<" ";

This prints W on the output screen with a space.

B W

W

The value of j is incremented to 1.

j = 2

At second iteration of inner loop:

j = 2

j<=N is true because j=2 and 2=2

So the program enters the body of the inner for loop. It has an if statement:

if((i+j)%2==0) this statement works as:

if(2+2) % 2 == 0

(2+2 )% 2 takes the mod of 2+2 with 2 which gives the remainder of the division.

4%2 As 4 is completely divisible by 2 so 4%2 == 0

Hence the if condition evaluates to false. So the statement in if part executes:

cout<<black<<" ";

This prints B on the output screen with a space.

B W

W B

The value of j is incremented to 1.

j = 3

Now  

j<=N is false because j=3 and 3>2

So the loop breaks and program moves to the outer loop. The value of outer loop variable i is incremented to 1 so i = 3

N = 2

outer loop:

i=3

i<=N is false because i=3 and 3>2

So this outer loop ends.

Now the output of this program is:

B W

W B

Screenshot of this program along with its output is attached.

8 0
2 years ago
Which group on the Note Master tab contains the command to add footers to the notes pages?
nasty-shy [4]

Answer:

Place Holders

Explanation:

5 0
2 years ago
The U.S. continues to become more dependent on the global domain within the information environment consisting of the interdepen
Hoochie [10]

Answer:

"Cyberspace " is the right answer.

Explanation:

  • Cyberspace seems to be an interactive computational environment, unconstrained by distance and perhaps other functional disabilities. William Gibson developed the word for representing a sophisticated augmented reality infrastructure in his story Neuromancer.
  • The virtual space generated over the network through synchronized computing devices.

So that the above would be the correct answer.

4 0
3 years ago
Other questions:
  • would specify that only selected members of the payroll and human resources department would have the right to change sensitive
    11·1 answer
  • For a class project, Jerome builds a simple circuit with a battery and three light bulbs. On his way to school, Jerome drops his
    9·1 answer
  • "what type of index has an index key value that points to a data row, which contains the key value? "
    9·1 answer
  • A keyboard and touch screen are the most common of ________ devices. select one:
    11·1 answer
  • Information is best described as
    10·1 answer
  • Write two cin statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a dash,
    7·1 answer
  • program 2. write a VB.NET program to solve the linear equation of the form Ax+B=C, i.e x=(C=B)/A (Eg:2x+3=7, where B and C are c
    15·1 answer
  • 5. The command to add new layout to the slide is present in<br>tab.​
    15·1 answer
  • What happens when the electrons flowing through the light bulb change direction?
    11·1 answer
  • Which of the following statements is correct? User data cannot be combined and shared among authorized users. In a nondatabase,
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!