Thursday, 12 January 2012

w.a.p to print no is even or odd.

#include<stdio.h>
#include<conio.h>
void main()
{
     // print no is even or odd
      int a;
       printf("enter number::\n");
       scanf("%d",&a);
       if (a%2==0)
      {
          printf("no. is even\n);
      }
       else
       {
           printf("no. is odd\n");
       }
        getch();
}
out put:-
enter number::
2
no is even

w.a.p to print number positive or negative.

#include<stdio.h>
#include<conio.h>
void main()
{
    // print no. is positive or negative
     int a;
     clrscr();
     printf("enter number::\n");
     scanf("%d",&a);
     if (a>0)
     {
         printf("no. is positive\n");
     }
      else
      {
         printf("no. is negative\n");
       }
       getch();
}
out put:-
enter number
-5
no. is negative