SHOW:
|
|
- or go back to the newest paste.
| 1 | /* C programme to check if a number is positive or not */ | |
| 2 | #include<stdio.h> | |
| 3 | int main(void) | |
| 4 | {
| |
| 5 | float a; | |
| 6 | printf("enter a number to check whether it is positive or not\n");
| |
| 7 | scanf("%f",&a);
| |
| 8 | if(a>0) | |
| 9 | {
| |
| 10 | printf("positive\n");
| |
| 11 | } | |
| 12 | else if(a<0) | |
| 13 | {
| |
| 14 | printf("negative\n");
| |
| 15 | } | |
| 16 | else | |
| 17 | {
| |
| 18 | printf("zero\n");
| |
| 19 | } | |
| 20 | return 0; | |
| 21 | } |