C program to calculate the sum of two integers using pointer.

 

C program
C PROGRAM 


C program to calculate the sum of two integers using pointer

#include <stdio.h>
int main()
{
   int first, second, *a, *b, sum;
   printf("Enter two integers to add\n");
   scanf("%d%d", &first, &second);
   a = &first;
   b = &second;
   sum = *a + *b;
   printf("Sum of the two numbers = %d\n", sum);
   return 0;
}

OUTPUT:

Enter two integers to add
6773
5527
Sum of the two numbers = 12300
[Process completed - press Enter]

Comments

Popular posts from this blog

Write a program to calculate a students result based on two examinations, 1 sports event, and 3 activities conducted. The weightage of activities= 30%, sports= 20% , and examinations= 50%.

Determine the intensity of shear of an oil having viscosity= 1 poise. The oil is used for lubricating the clearance between a shaft of diameter 10 cm and its journal bearing. The clearance is 1.5mm and the shaft rotates at 150 r.p.m.