Saturday, 26 January 2013

Relational Operators in C Programing

#include<conio.h>
    #include<stdio.h>
    main()
    {
    int a,b,c;
    clrscr();
    printf("Enter 2 No's: ");
    scanf("%d%d",&a,&b);
    printf("\na = %d",a);
    printf("\nb = %d",b);
    printf("\na>b = %d",a>b);
    printf("\na<b = %d",a<b);
    printf("\na>=b = %d",a>=b);
    printf("\na<=b = %d",a<=b);
    printf("\na==b = %d",a==b);
    printf("\na!=b = %d",a!=b);
    getch();
    }

Swapping of Given Two Numbers

#include<conio.h>
    #include<stdio.h>
    main()
    {
    int a,b,c;
    clrscr();
    printf("Enter 2 No's: ");
    scanf("%d%d",&a,&b);
    printf("\nBefour Swaping");
    printf("\na = %d",a);
    printf("\nb = %d",b);
    c=a;
    a=b;
    b=c;
    printf("\nAfter Swaping");
    printf("\na = %d",a);
    printf("\nb = %d",b);
    getch();
    }