Program to Accept the Values of Two Variables in C
#include <stdio.h>
int main()
{
int a, b;
printf(“Enter the value of first variable: “);
scanf(“%d”, &a);
printf(“Enter the value of second variable: “);
scanf(“%d”, &b);
printf(“Value of first variable = %d\n”, a);
printf(“Value of second variable = %d\n”, b);
return 0;
}
Explanation
int a, b;declares two integer variables.scanf()accepts values from the user.&aand&bprovide the memory addresses where the entered values are stored.printf()displays the values of both variables.