EmbLogic's Blog

Number: Positive or Negative

1        #include <stdio.h>
2        int main()
3        {
4         int a;
5         printf(“enter a number\n”);
6         scanf(“%d”, &a);
7         if(a > 0)
8         {
9         printf(“it is positive\n”);
10         }
11         else if(a < 0)
12         {
13                 printf(“it is negative\n”);
14         }
15         else
16         {
17                 printf(“it is zero\n”);
18         }
19 }
~

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>