Computer Science, asked by anandprakashinjsr, 13 hours ago

Q basic WAP to store weight in grams . Now covert and display it into kg.​

Answers

Answered by anindyaadhikari13
2

\texttt{\textsf{\large{\underline{Solution}:}}}

The given co‎de is written in QBASIC.

CLS

INPUT "Enter weight in grams: "; G

KG = G / 1000

PRINT "Weight in kg ="; KG

END

\texttt{\textsf{\large{\underline{Explanation}:}}}

  • Line 1: Clears the screen.
  • Line 2: Accept the weight in grams.
  • Line 3: Divide the weight by 1000 to get the weight in kg.
  • Line 4: Display the weight in kg.
  • Line 5: End of program.

See the attachment for output.

Attachments:
Answered by purveshKolhe
2

\huge{ \green{ \boxed{ \red{ \mathfrak{answer \: : }}}}}

You can use the following program::

CLS

INPUT "Enter weight in grams : ", grams

PRINT "Your answer in KGs : " + grams / 1000

END

Output::

Sample input = 10000

Sample output = Your answer in KGs : 10

Logic::

==> Grams are stored in variable named gram.

==> It takes input and outputs it in KGs.

Hope This Helps You..

Similar questions