Showing posts with label Program to add two number using pointers.. Show all posts
Showing posts with label Program to add two number using pointers.. Show all posts

Program to add two number using pointers.

Program to add two number using pointers.
#include<stdio.h>
#include<conio.h>
void main()
{
int *p1,*p2,sum;
clrscr();
printf(“enter two no’s: ”);
scanf(“%d%d”,&*p1,&*p2);
sum=*p1+*p2;
printf(“sum=%d”,sum);
getch();
}
Output:
enter two no’s: 10
20
sum=30

Program to add two number using pointers.

Program to add two number using pointers.
#include<stdio.h>
#include<conio.h>
void main()
{
int *p1,*p2,sum;
clrscr();
printf(“enter two no’s: ”);
scanf(“%d%d”,&*p1,&*p2);
sum=*p1+*p2;
printf(“sum=%d”,sum);
getch();
}
Output:
enter two no’s: 10
20
sum=30