Translate

Saturday, May 2, 2020

C Program to Swap two number with using temporary variable

/* Swap the Value with the help of temporary variable*/ 

#include<stdio.h>
#include<conio.h>
void main()
{
    int a, b, temp;
    printf("Enter First number in a = ");
    scanf("%d",&a);
    printf("Enter Second number in b = ");
    scanf("%d",&b);
     temp=a;
       a=b;
       b=temp;
    printf("\nafter swaping the value of a = %d", a);
    printf("\nafter swaping the value of b = %d", b);
    getch();
}
Output:

No comments:

Post a Comment

C program to make a calculator using the switch statement.

/*perform arithmetic calculation on integers in C language*/ #include<stdio.h> #include<conio.h> void main() {     char op;     ...