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
ella [17]
3 years ago
13

Write a program. in QBAsSIC

Computers and Technology
1 answer:
goblinko [34]3 years ago
5 0

Answer:

The program is as follows:

<em>5 INPUT A,B</em>

<em>6 PROD = A * B</em>

<em>7 PRINT PROD</em>

<em>8 TOTAL = A + B</em>

<em>9 PRINT TOTAL</em>

<em>10 DIFF = A - B</em>

<em>11 PRINT DIFF</em>

<em>12 END</em>

Explanation:

This gets input for the two numbers

<em>5 INPUT A,B</em>

This calculates the product

<em>6 PROD = A * B</em>

This prints the calculated product

<em>7 PRINT PROD</em>

This calculates the sum

<em>8 TOTAL = A + B</em>

This prints the calculated sum

<em>9 PRINT TOTAL</em>

This calculates the difference

<em>10 DIFF = A - B</em>

This prints the calculated difference

<em>11 PRINT DIFF</em>

This ends the program

<em>12 END</em>

You might be interested in
Several of the eap protocols use ____, which creates a ciphertext from cleartext.
Norma-Jean [14]
Several of eap protocols use encryption function, which creates a ciphertext from cleartext.
<span />
6 0
3 years ago
6.25 (Prime Numbers) A positive integer is prime if it’s divisible by only 1 and itself. For example, 2, 3, 5 and 7 are prime, b
faltersainse [42]

Answer:

  1. public class Main {
  2.    public static void main (String [] args) {
  3.        for(int i = 2; i < 10000; i++){
  4.            if(isPrime1(i)){
  5.               System.out.print(i + " ");
  6.            }
  7.        }
  8.        System.out.println();
  9.        for(int i = 2; i < 10000; i++){
  10.            if(isPrime2(i)){
  11.                System.out.print(i + " ");
  12.            }
  13.        }
  14.    }
  15.    public static boolean isPrime1(int n){
  16.      
  17.        for(int i=2; i <= n/2; i++){
  18.            if(n % i  == 0){
  19.                return false;
  20.            }
  21.        }
  22.        return true;
  23.    }
  24.    public static boolean isPrime2(int n){
  25.        for(int i=2; i <= Math.sqrt(n); i++){
  26.            if(n % i  == 0){
  27.                return false;
  28.            }
  29.        }
  30.        return true;
  31.    }
  32. }

<u></u>

Explanation:

Firstly, create the first version of method to identify a prime number, isPrime1. This version set the limit of the for loop as n/2. The for loop will iterate through the number from 2 till input n / 2 and check if n is divisible by current value of i. If so, return false to show this is not a prime number (Line 22 - 26). Otherwise it return true to indicate this is a prime number.

In the main program, we call the isPrime1 method by passing the i-index value as an argument within a for-loop that will iterate through the number 2 - 10000 (exclusive).  If the method return true, print the current i value). (Line 5 - 9)

The most direct way to ensure all the prime numbers below 10000 are found, is to check the prime status from number 2 - 9999 which is amount to 9998 of numbers.

Next we create a second version of method to check prime, isPrime2 (Line 31 - 40). This version differs from the first version by only changing the for loop condition to i <= square root of n (Line 33).  In the main program, we create another for loop and  repeatedly call the second version of method (Line 13 - 17). We also get the same output as in the previous version.

8 0
3 years ago
Jake is photographing his pet puppy. He wants to preview the image the camera will capture. What part of the camera that is insi
german

A. i think that is right

3 0
3 years ago
Read 2 more answers
Explain the working system of computer systems with examples​
geniusboy [140]

,I don't know you all about computer

8 0
3 years ago
Write a SQL query to find the population of the planet named 'Caprica' -- 10 points Find the first name, last name, and age of p
Artemon [7]

The question is incomplete! Complete question along with answer and step by step explanation is provided below.

Please find the attached question.

Answer:

a) SQL Query:

SELECT population

FROM bsg_planets

WHERE name='Caprica';

b) SQL Query:

SELECT fname, lname, age

FROM bsg_people

WHERE lname!='Adama';

c) SQL Query:

SELECT name, population

FROM bsg_planets

WHERE population > 2600000000

d) SQL Query:

SELECT fname, lname, age

FROM bsg_people

WHERE age IS NULL;

Explanation:

a) Write a SQL query to find the population of the planet named 'Caprica'

Syntax:

SELECT  Column

FROM TableName

WHERE Condition;

For the given case,

Column = population

TableName  = bsg_planets

Condition = name='Caprica'

SQL Query:

SELECT population

FROM bsg_planets

WHERE name='Caprica';

Therefore, the above SQL query finds the population of the planet named 'Caprica' from the table bsg_planets.

b) Find the first name, last name, and age of people from bsg_people whose last name is not 'Adama'

Syntax:

SELECT  Column1, Column2, Column3

FROM TableName

WHERE Condition;

For the given case,

Column1 = fname

Column2 = lname

Column3 = age

TableName  = bsg_people

Condition = lname!='Adama'

SQL Query:

SELECT fname, lname, age

FROM bsg_people

WHERE lname!='Adama';

Therefore, the above SQL query finds the first name, last name and age of people whose last name is not 'Adama' from the table bsg_people.

c) Find the name and population of the planets with a population larger than 2,600,000,000

Syntax:

SELECT  Column1, Column2

FROM TableName

WHERE Condition;

For the given case,

Column1 = name

Column2 = population

TableName  = bsg_planets

Condition = population > 2600000000

SQL Query:

SELECT name, population

FROM bsg_planets

WHERE population > 2600000000

Therefore, the above SQL query finds the name and population of the planets with a population larger than 2,600,000,000 from the table bsg_planets.

d) Find the first name, last name, and age of people from bsg_people whose age is NULL

Syntax:

SELECT  Column1, Column2, Column3

FROM TableName

WHERE Condition;

For the given case,

Column1 = fname

Column2 = lname

Column3 = age

TableName  = bsg_people

Condition = age IS NULL

SQL Query:

SELECT fname, lname, age

FROM bsg_people

WHERE age IS NULL;

Therefore, the above SQL query finds the first name, last name and age of people whose age is NULL from the table bsg_people.

6 0
4 years ago
Read 2 more answers
Other questions:
  • A few questions related to power point.
    8·1 answer
  • Which of the following is NOT a search engine ( Bing, Yahoo, Ask, Twitter)
    6·2 answers
  • Consolidating a system's physical and time resources is known as ________________.
    13·1 answer
  • I NEED HELP PLEASE ITS TIMED
    9·1 answer
  • C programming: loading a dictionary into a trie data structure. Why am I segfaulting?
    8·1 answer
  • RIGHT ANSWER GETS BRAINLEST
    5·1 answer
  • Given N lines of input, print the 3rd character from each line as a new line of output. It is guaranteed that each of the n line
    8·1 answer
  • Refer to the exhibit. What kind of NAT is configured on the ASA device?
    10·1 answer
  • What was the strategy the company adopted for ERP implementation?
    6·1 answer
  • A classic game, Wario Land, has an invincible main character who reacts to the environment in order to solve puzzles. So, for ex
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!