Pages

Thursday, December 1, 2011

C Programming to read two numbers, swap them and display


#include<stdio.h>
#include<stdlib.h>
int main()
{
    float a,b,temp;
    printf("Enter the first number: ");
    scanf("%f",&a);
    printf("Enter the second number: ");
    scanf("%f",&b);
    temp=a;
    a=b;
    b=temp;
    printf("The first number is:%f",b);
    printf("\nThe second number is:%f",a);
    system("pause");
    return 0;
}

No comments:

Post a Comment