C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

Write a C program to add two numbers through variables and their pointers?

0 votes
36 views
asked by smith Geek (15,340 points)

1 Answer

0 votes

#include<stdio.h>

#include<conio.h>

void main()

{

int a,b,c,d,*ap,*bp;

clrscr();

printf(“Enter two numbers:”);

scanf(“%d%d”, &a,&b);

ap=&a;

bp=&b;

c=a+b;

d=*ap+*bp;

printf(“\n sum of A &B using variable:%d”,c);

printf(“\n sum of A &B using pointer:%d”,d);

getch();

}

Output:

Enter two numbers: 8 4

Sum of a & B using variable:12

Sum of a & B using pointer:12 

answered by rajesh Guru (39,140 points)

Related questions

...