- 3

Write the program for this

Using a nested if statement, write a program that prompts the user for a number and then reports if the number is positive, zero or negative.

19th Nov 2021, 1:34 PM
Rose Candy
3 Respostas
+ 1
#include <stdio.h> int main() { double n; scanf("%lf", &n); printf("%lf\n", n); if (n>0) printf("%s", "positive"); if (n<0) printf("%s", "negative"); if (n==0) printf("%s", "zero"); return 0; } //Keep learning & happy coding :D https://code.sololearn.com/cfGjA9dl3GfG
19th Nov 2021, 2:54 PM
SoloProg
SoloProg - avatar
+ 3
What help you need there..? (Except complete solution, you can specify details..) What have you tried so far..? pls post your try.
19th Nov 2021, 1:37 PM
Jayakrishna 🇮🇳
0
You statement nearly has all the template you need. Accept input from user as number; Check IF Value not 0{ Check If value is greater then 0{ Print string positive; Exit; } Else { Print string negative; Exit; } Print string zero Just put that in the language of your choice.
19th Nov 2021, 2:13 PM
William Owens
William Owens - avatar