Sunday, May 12, 2013

c programing

Hello friends after many days i have came with c programming.today we will learn condition program.Write this code.

#include <stdio.h>
int main()
{
       int n;
       n=10;
       if(n<10) {
       printf("the number is negative\n");
       }
       else {
       printf("the number is positive\n");
       }
    return 0;
}

First we have  test n is zero or not.If zero then negative or if it is not then positive.If any one have confusion then see this code.

#include <stdio.h>
int main()
{
        int n=10;
        if(n<10){
        printf("the number is negative\n");
        }
        else if(n>10){
       printf("the number is positive\n");
       }
       else if(n==0){
      printf("the number is zero\n");
      }
   return 0;


1 comment: