(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

(j) In a town, the percentage of men is 52. The percentage of total literacy is 48. If total percentage of literate men is 35 of the total population, write a program to find the total number of illiterate men and women if the population of the town is 80,000.

(d) Temperature of a city in Fahrenheit degrees is input through the keyboard. Write a program to convert this temperature into Centigrade degrees.

(a) Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.