SWAP TWO Numbers BY USING THIRD VARIABLE | CppDroid - NRTrickHub

Latest Update

Friday, October 07, 2016

SWAP TWO Numbers BY USING THIRD VARIABLE | CppDroid

Swap two numbers by using Third variable:
Source Code :
#include<stdio.h>
#include<conio.h>

int main()

{
    float A, B, C;
    //using of float
    printf("Enter value of A: ");
    scanf("%f",&A);
    //%f using for float
    // float using for desimal value i.e; 0.00

     printf("Enter value of B: ");
    scanf("%f",&B);

    C = A;
    A = B;
    B = C;

   printf("\nAfter swaping value of A:%.f",A);
   printf("\nAfter swaping value of B:%.f",B);
    // \n use for new line or line break
    return 0;
}

Output:


YouTube Watch :


No comments:

Post a Comment