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
algol [13]
3 years ago
8

Develop a program that will calculate the area and perimeter of a rectangle. The length and width can be given as constant.(LENG

TH= 8 WIDTH=8).
Computers and Technology
1 answer:
o-na [289]3 years ago
8 0

Answer:

#include <iostream>

using namespace std;

int main()

{

 

  int length = 8;

  int width = 8;

 

  int perimeter = 2*(length + width);

  int area = length * width;

 

  cout<<"The perimeter is "<<perimeter<<endl;

  cout<<"The area is "<<area<<endl;

 

  return 0;

}

Explanation:

include the library iostream for using the input/output instructions in the c++ programming.

Create the main function and define the variable length and width with values.

Then, use the formula for calculating the perimeter and area of rectangle.

perimeter = 2*(length + width)

area = length * width

and store in the variables and finally print the output.

You might be interested in
write an assembly language procedure that also performs the binary search. The C program will time multiple searches performed b
laiz [17]

Answer:

Let’s identify variables needed for this program.

First variables will be the one which will hold the values present in the Given Numbers in Array list and key of 16-bit and it will be array ARR and KEY. variables will be holding the Messages MSG1 “KEY IS FOUND AT “, RES ”  POSITION”, 13, 10,” $” and MSG2 ‘KEY NOT FOUND!!!.$’ to be printed for the User. Other variables will be holding Length of the Array and it will be LEN, So in all Six variables.

The identified variables are ARR, KEY, LEN, RES, MSG1 and MSG2.

DATA SEGMENT

    ARR DW 0000H,1111H,2222H,3333H,4444H,5555H,6666H,7777H,8888H,9999H

    LEN DW ($-ARR)/2

    KEY EQU 7777H

    MSG1 DB "KEY IS FOUND AT "

    RES DB "  POSITION",13,10," $"

    MSG2 DB 'KEY NOT FOUND!!!.$'

DATA ENDS

CODE SEGMENT  

   ASSUME DS:DATA CS:CODE

START:

     MOV AX,DATA

     MOV DS,AX

   

     MOV BX,00

     MOV DX,LEN

     MOV CX,KEY

AGAIN: CMP BX,DX

      JA FAIL

      MOV AX,BX

      ADD AX,DX

      SHR AX,1

      MOV SI,AX

      ADD SI,SI

      CMP CX,ARR[SI]

      JAE BIG

      DEC AX

      MOV DX,AX

      JMP AGAIN

BIG:   JE SUCCESS

      INC AX

      MOV BX,AX

      JMP AGAIN

SUCCESS: ADD AL,01

        ADD AL,'0'

        MOV RES,AL

        LEA DX,MSG1

        JMP DISP

FAIL: LEA DX,MSG2

DISP: MOV AH,09H

     INT 21H

     

     MOV AH,4CH

     INT 21H      

CODE ENDS

END START

In this Assembly Language Programming, A single program is divided into four Segments which are 1. Data Segment, 2. Code Segment, 3. Stack Segment, and 4. Extra  Segment. Now, from these one is compulsory i.e. Code Segment if at all you don’t need variable(s) for your program.if you need variable(s) for your program you will need two Segments i.e. Code Segment and Data Segment.

Explanation:

The attached Logic is a C like Program to conduct a binary search we need small Algorithm Shown above in a very simple way, So Just we will covert the logic into Assembly There are many things uncommon in the programing Language. There are No While Loops or Modules but this things are to be implemented in different ways.

6 0
3 years ago
Any information that is processed by and sent out from a computer or other electronic device is considered __________.
wel

Answer:

Your answer will be output.

Hope this helps!

3 0
3 years ago
Read 2 more answers
How many total numbers can be represented with an 8 bit binary (base-2) system
KATRIN_1 [288]

Answer:

256.

Explanation:

In Computer science, a bit is a short word for the term binary digit and is primarily the basic (smallest) unit measurement of data or information.

A bit is a logical state which represents a single binary value of either one (1) or zero (0). This ultimately implies that, a single bit in computer science represents a boolean value of;

1. True or ON, which is equal to one (1).

2. False or OFF, which is equal to zero (0).

Additionally, a binary numbering represents all numeric values that are to be written in sequences of ones (1s) and zeroes (0s). Therefore, a binary number refers to any numerical value (number) that is expressed in base-2 numerical system; 0s and 1s.

Also, the total numbers which can be represented with an 8 bit binary (base-2) system is 256.

Mathematically, it is given by the equation;

2^{n}

Given that n = 8

2^{8} = 256

8 0
3 years ago
For what tools such as USMT and Treanxition used?
Hitman42 [59]

Answer:

A. Migration

Explanation:

5 0
3 years ago
Describe how to add images and shapes to a PowerPoint
kvasek [131]
You can use Microsoft paint to make the sales and then export them to Microsoft word or just go online and get the shapes images and copy and paste them on to the PowerPoint
8 0
2 years ago
Other questions:
  • Accessing calendars, contact information, email, files and folders, instant messaging, presentations, and task lists over the in
    8·2 answers
  • PLS HELP ASAP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    15·1 answer
  • Where do today's computers store almost all motherboard configuration data?
    15·1 answer
  • can An intelligent workplace uses technology to allow workers to be productive whether they are in the office or working from ho
    12·1 answer
  • if an individual inserts a thumb drive containing classified information on a computer in the office that is not part of the cla
    9·1 answer
  • Which of the following conditions will maximize the amount of interest you earn
    5·1 answer
  • A palindrome is a string that reads the same both forward and backward. For example, the string madam is a palindrome. Write a p
    13·1 answer
  • Use these sentence starters to explain how Cat Insanity is an analogy for debt repayment.
    7·1 answer
  • Which of the following is a property of TCP?
    8·1 answer
  • Write a function NumberOfPennies() that returns the total number of pennies given a number of dollars and (optionally) a number
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!