(f) Two numbers are input through the keyboard into two locations C and D. Write a program to interchange the contents of C and D.

Let Us C by Yashwant Kanetkar

 
Solution By Muhammad Kaleem UIlah



                                                                  Exercise Questions 
[H] Write C programs for the following:
(f) Two numbers are input through the keyboard into two locations C and D. Write a program to interchange the contents of C and D.
#include <stdio.h>
#include <stlib.h>

int main ()

{

    int A,B,C;

    printf("\n\t\tEnter Your First Number =");

    scanf("%d",&A);

    printf("\n\t\tEnter Your 2nd Number = ");

    scanf("%d",&B);

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

    printf("\n\t\t A = %d",A);

    printf("\n\t\t B = %d\n",B);

}

Comments

Popular posts from this blog

EXERCISE 01 Complete Solved LET US C by Yashwant Kanetkar

(k) A cashier has currency notes of denominations 10, 50 and 100. If the amount to be withdrawn is input through the keyboard in hundreds, find the total number of currency notes of each denomination the cashier will have to give to the withdrawer.

(g) If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits. (Hint: Use the modulus operator ‘%’)