Write a C-program to swap two number:

Swap Two Number:

Tips:

 1.Take three variables.
 2.Take two inputs from user.
 3.Assign variables one by one each other.


Code:

main()
{
    int a,b,s;
    printf("Enter two number two swap:\n");
    scanf("%d%d",&a,&b);
    printf("\nyou decide:\na=%d and b=%d",a,b);
    getch(0);
    s=a;
    a=b;
    b=s;
    printf("\nThe swap number is: a=%d and b=%d",a,b);
    getch();
}

Output:

 

Please comment!

Comments

Popular posts from this blog

TOP 10 PROGRAMMING LANGAUAGES COMMING 2021 | ARTICLE

Print Fibonacci Series using Recursion | C program :