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]

No comments:

Post a Comment




Copyright Ⓒ 2022 | Mechpedia | All Right Reserved.