Accountancy, asked by chaudharylalbabu413, 7 months ago

Write a C++ program wheck whether a given number is greater than 18 or not

Answers

Answered by Berseria
26

\huge\bold{AnSwEr}

➜syntax \: of \: if \:  else \: statement :  -

if(text \: expression) \\{ \\ statement \: block  \\ } \\ else \\ { \\ statement \: block \: 2 \\ }

\sf\blue{the \: required \: C++\:  program:-}

#include <iostream>

using namespace std;

int main( )

{

int num;

cout<<"\n enter a number";

cin>>num;

if( num>=18)

{

cout<<"\n Number is greater than 18";

}

else

{

cout<<"\n number is not greater than 18";

}

}

note : make \: sure \: while \: writting \:  programme\\that \: all \: signs \: are \: inserted.\\ \\</p><p>\rm{then \: the \: output \: is ↝\: }

\rm{enter \: a \: number = 21 \: number \: is \: greater \: than \: 18 \\ enter \: a \: number = 10 \: number \:is \: not \: greater \: than \: 18 }[/tex]

hope this helps..

Similar questions