Computer Science, asked by poornimachavla2020, 3 months ago

Write an algorithm to take a number as input from the user and print if it is
negative or positive

Answers

Answered by Anonymous
4

Answer:

Num <-- 0.

Read Num.

Is (Num > 0) Then. Begin. Print “Positive” End. Else if (Num<0) Then. Begin. Print “Negative” End. Else. Begin. Print “Zero” End.

Explanation:

HOPE IT HELPS YOU

TAKE CARE

HAVE A NICE DAY

Answered by vaishu775
6

\begin{gathered}\: \bigstar\:\: \:\underline {\red {\pmb{\mathbb{ REQUIRED \:\:PYTHON \:\:PROGRAM \::\:}}}}\:\\\\\end{gathered}

\begin{gathered}\qquad \tt{ \:num\:=\:float\: (\:input\:(\:\red{"\:Enter\: a \;number\::\: "}\:)\:)}\\ \qquad \tt{\:\blue{ if}\: num \: &gt; \: 0\::\:}\\\qquad \qquad \tt{ print\:(\:\red{"\:The \:Entered\:number \:is \:Positive \:number\:"}\:)\:}\\ \qquad \tt{\:\blue{ elif}\: num \:==\: 0\::\:}\\\qquad \qquad \tt{ print\:(\:\red{"\:The\:Entered\:number \:is\:zero\:"}\:)\:}\\\qquad \tt{\:\blue{ else}\: num \::\:}\\\qquad \qquad \tt{ print\:(\:\red{"\:The\:Entered\:number \:is\:negative \:number\:"}\:)\:}\\\\\end{gathered}

\begin{gathered}\dag \:\:\large\underline { \underline {\red{\pmb{\bf Output \: \:\:-\: }}}}\\\\\end{gathered}

\begin{gathered}\large \underline {\underline {\purple {\sf\:(\;1\;)\:}}}\\\end{gathered}

\begin{gathered}\qquad \sf Enter \: a \: number \:: \: \bf 7 \\\end{gathered}

\begin{gathered} \qquad \qquad \sf The\:Entered \:number \:is \:\bf Positive \:number \:\\\\\\\end{gathered}

\begin{gathered}\large \underline {\underline {\purple {\sf\:(\;2\;)\:}}}\\\end{gathered}

\begin{gathered}\qquad \sf Enter \: a \: number \:: \: \bf 0 \\\end{gathered}

\begin{gathered} \qquad \qquad \sf The\:Entered \:number \:is \:\bf Zero \:\\\\\\\end{gathered}

\begin{gathered}\large \underline {\underline {\purple {\sf\:(\;3\;)\:}}}\\\end{gathered}

\begin{gathered}\qquad \sf Enter \: a \: number \:: \: \bf -5\\\end{gathered}

\begin{gathered} \qquad \qquad \sf The\:Entered \:number \:is \:\bf Negative \:number \:\\\\\\\end{gathered}

Similar questions