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
//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:
Post a Comment