Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Saturday, February 19, 2011

C26 : Addition of two numbers using pointer

Back to Home   &  C


//Program to print addition of two numbers by using pointer

#include<stdio.h>
#include<conio.h>
void main()
{
int num1,num2,*p1,*p2,*p3;
clrscr();
printf("Enter first number\n");
scanf("%d",&num1);
printf("Enter second number\n");
scanf("%d",&num2);
p1=&num1;
p2=&num2;
*p3=*p1+*p2;
printf("addition=%d",*p3);
getch();
}
------------------------------------------------------------
Output
Enter first number
40
Enter second number
30
Addition=70
===============================================
Back to Home   &  C

No comments: