Cheak number is ‘negative’ or ‘positive’….
This programme is very simple so, you can understand very eaisly. Here only use the condition programme in it. Compare with only Zero.
Some important symbols used in code.
- () small bracket
- && use for ‘and’ use for address
- {} curly bracket
- “” double code

- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- int a, b, c;
- clrscr();
- printf(“Inputs any number to know it is positive or negative”);
- scanf(“%d”, &a);
- if(a>=0)
- {
- printf(“it is a positive = %d”, a);
- }
- else
- {
- printf(“it is a negative = %d”, a);
- }
- getch();
- }

Results..

Cheak number is ‘negative’ or ‘positive’ by condition operator….

- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- int a, b, c;
- clrscr();
- printf(“Inputs any number to know it is positive or negative”);
- scanf(“%d”, &a);
- a>0? printf(“it is a positive = %d”, a):printf(“it is a negative = %d”, a);
- getch();
- }
Results..


