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
Sladkaya [172]
3 years ago
11

Write code that read from variables N and M, multiply these two unsigned 32-bit variables and store the result in Variables P, Q

. (
Computers and Technology
1 answer:
Tamiku [17]3 years ago
8 0

Answer:

Using C language;

#include <stdio.h>

int main()

{

int N, M;

printf("Please enter two numbers: ");

scanf("%d %d", &N, &M);

int P,Q = N*M;

return 0;

}

Explanation:

The variables N and M are declared and the "scanf" function is used to assign a value to the variables from the input prompt, then the product of N and M are saved to the P and Q variables.

You might be interested in
The Zootopia Police Department is recruiting new officers and has come up with an innovative equation to hire. They define hireS
Dahasolnce [82]

Answer:

#include<iostream>

#include<limits>

#include<iomanip>

using namespace std;

//function that returns true

//if there is invalid input like giving string as input

// for integer value.

bool isInvalidInput()

{

  //return true if cin.fail

  if(cin.fail())

  {

      //clear the buffer

      cin.clear();

      cin.ignore(numeric_limits<streamsize>::max(),'\n');

      return true;

  }

  return false;

}

//function that calculates the hire score for given 3 parameters.

double calHireScore(double agility,double strength,double speed)

{

  return (1.8*agility) + (2.16 * strength) + (3.24 * speed);

}

//calculate hire score for fox.

void calFoxHireScore()

{

  double agility,strength;

 

  cout<<"Enter Agility Value: ";

  //get agility as input and validate it.

  cin >> agility;

  if(isInvalidInput() || agility <= 0)

  {

      cout<<"\nError: Agility value must be > 0"<<endl;

      return;

  }

 

  cout<<"Enter Strength Value: ";

  cin >> strength;

  if(isInvalidInput() || strength <= 0)

  {

      cout<<"\nError: Strength value must be > 0"<<endl;

      return;

  }

 

  cout<<"\nHire Score for Fox: "<<calHireScore(agility,strength,0)<<endl;

}

//function that asks input from user for

//calculating hire score for Sloth.

void calSlothHireScore()

{

  double strength,speed;

 

  cout<<"Enter Strength Value: ";

  cin >> strength;

  if(isInvalidInput() || strength <= 0)

  {

      cout<<"\nError: Strength value must be > 0"<<endl;

      return;

  }

 

  cout<<"Enter Speed Value: ";

  cin >> speed;

  if(isInvalidInput() || speed <= 0)

  {

      cout<<"\nError: Speed value must be > 0"<<endl;

      return;

  }

 

  cout<<"\nHire Score for Sloth: "<<calHireScore(0,strength,speed)<<endl;

}

//function that asks input from user for

//calculating hire score for Bunny.

void calBunnyHireScore()

{

  double agility,speed;

 

  cout<<"Enter Agility Value: ";

  cin >> agility;

  if(isInvalidInput() || agility <= 0)

  {

      cout<<"\nError: Agility value must be > 0"<<endl;

      return;

  }

 

  cout<<"Enter Speed Value: ";

  cin >> speed;

  if(isInvalidInput() || speed <= 0)

  {

      cout<<"\nError: Speed value must be > 0"<<endl;

      return;

  }

 

  cout<<"\nHire Score for Bunny: "<<calHireScore(agility,0,speed)<<endl;

}

//function to display menu for user.

void menu()

{

  cout<<"\n1. Fox"<<endl;

  cout<<"2. Bunny"<<endl;

  cout<<"3. Sloth"<<endl;

  cout<<"0. Quit"<<endl;

  cout<<"Enter your choice: ";

}

//main method

int main()

{

  int choice;

  do

  {

      //asks choice

      menu();

      cin >> choice;

      //if invalid input print erro message

      if(isInvalidInput())

      {

          cout<<"\nError: Invalid choice enetered. Try Again\n";

      }

      else

      {

          cout<<"\n";

          //if any one of the choices do accordingly

          //for invalid choice print error mesage.

          switch(choice)

          {

              case 1:

                  calFoxHireScore();

                  break;

              case 2:

                  calBunnyHireScore();

                  break;

              case 3:

                  calSlothHireScore();

                  break;

              case 0:

                  cout<<"\nQutting...\n";

                  break;

              default:

                  cout<<"Invalid choice entered."<<endl;

                  break;

          }

      }

     

  }while(choice != 0);

 

  return 0;

}

Explanation:

3 0
3 years ago
You wrote a program to allow the user to guess a number. Complete the code to generate a random integer from one to 10.
just olya [345]

Answer:

randint

Explanation:

Just did my quiz and got a 100%

7 0
3 years ago
Read 2 more answers
What does a first line indent look like
algol13
If u mean the indent when you’re writing an essay, then it is an indent to show how u separate the paragraphs. Hope this helps.
5 0
3 years ago
Planet X is a terrestrial planet in our solar system. It has 21% oxygen in its atmosphere. Humans can walk on this planet withou
Arte-miy333 [17]
Based on the given description above, the planet that is being described would be planet EARTH. It is the only planet where humans can walk without the aid of a space suit, and the only planet that can provide humans the necessary oxygen to survive. Hope this answers that question.
8 0
3 years ago
Read 2 more answers
What method of the String object searches the string for an occurence of the specified search string?
KATRIN_1 [288]

Answer:

the indexOf() method

Explanation:

The indexOf() method in java returns the first occurrence of the of the string or a character specified in it.It can be used to search both a character or a string.

for example:-

import java.util.*;

import java.lang.*;

import java.io.*;

class indexOf

{

public static void main (String[] args)

{

    String s="IamNumber4";

    int l=s.indexOf("Num");//using indexOf() method on string object..

    System.out.println(l);

}

}

Output:-

3

3 0
3 years ago
Other questions:
  • Which part of the os provides users and applications with an interface to manipulate files?
    8·1 answer
  • What additional features on your router would you implement if you were setting up a small wired and wireless network
    5·1 answer
  • Encryption Using Rotate Operations Write a procedure that performs simple encryption by rotating each plaintext byte a varying n
    10·1 answer
  • You can access various sites on WWW by using hyperlinks or by?
    6·2 answers
  • 1.) Florida has ____________ roads that are designated as part of the National Highway System.
    12·1 answer
  • Select the correct answer.
    12·2 answers
  • What is the use of a piano​
    10·2 answers
  • In case of a suspected data breach, what course of action should a chief information security officer (CISO) take
    9·1 answer
  • Write a program that repeatedly shows the user a menu to select the shape form three main shapes or to print the shapes created
    15·1 answer
  • A sensitive manufacturing facility has recently noticed an abnormal number of assembly-line robot failures. Upon intensive inves
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!