6-Write a C program to swap the two numbers.

Program: 6

Write a C program to swap the two numbers.

#include
#include
void main()
{
    int a, b , c;
    printf("Enter the value of a: ");
    scanf("%d", &a);
    printf("Enter the value of b: ");
    scanf("%d", &b);
    c=a;
    a=b;
    b=c;
    printf("The value of a is: %d\n", a);
    printf("The value of b is: %d", b);
    getch();
}
Output
Enter the value of a: 43

Enter the value of b: 65

The value of a is: 65

The value of b is: 43

Lokesh Kumar: Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.
Related Post
Leave a Comment

This website uses cookies.