Math, asked by resmi2397, 10 months ago

write a programme to input an integer and check whether it is positive, negative or zero by nested if in c++
urgent​

Answers

Answered by Shailesh183816
1

#include <iostream>

using namespace std;

int main()

{

signed long num1 = 0;

cout << "\n\n Check whether a number is positive, negative or zero :\n";

cout << "-----------------------------------------------------------\n";

cout << " Input a number : ";

cin >> num1;

if(num1 > 0)

{

cout << " The entered number is positive.\n\n";

}

else if(num1 < 0)

{

cout << " The entered number is negative.\n\n";

}

else

{

std::cout << " The number is zero.\n\n";

}

return 0;

}

\bf\huge\underline\red{Follow me}

Attachments:
Answered by Sachin5452
1

Answer:

#include <iostream>

using namespace std;

int main()

{

signed long num1 = 0;

cout << "\n\n Check whether a number is positive, negative or zero :\n";

cout << "-----------------------------------------------------------\n";

cout << " Input a number : ";

cin >> num1;

if(num1 > 0)

{

cout << " The entered number is positive.\n\n";

}

else if(num1 < 0)

{

cout << " The entered number is negative.\n\n";

}

else

{

std::cout << " The number is zero.\n\n";

}

return 0;

}

Similar questions