Sunday, September 16, 2012

Code# 41:C Program To Add Two numbers Using Pointers

| |

#include<stdio.h>

main()
{
   int first, second, *p, *q, sum;

   printf("Enter two integers to add\n");
   scanf("%d%d", &first, &second);

   p = &first;
   q = &second;

   sum = *p + *q;

   printf("Sum of entered numbers = %d\n",sum);

   return 0;
}
Output:
Enter two integers to add
7
6
sum of entered numbers =13

0 comments:

Post a Comment

Powered by Blogger.