Pages

Thursday, December 1, 2011

C Programming to swap two numbers without using third variable


/*to read two numbers and display in reverse order*/
#include<stdio.h>
#include<stdlib.h>
int main()
{
    float a,b,temp;
    printf("Enter your first digit: ");
    scanf("%f",&a);
    printf("Enter your second digit: ");
    scanf("%f",&b);
    printf("The first number=%f",b);
    printf("\nThe second number=%f",a);
    system("pause");
    return 0;
}

No comments:

Post a Comment