Thursday, 4 November 2021

C Program for Adding two numbers using Pointers

C Program for Adding two numbers using Pointers

Program:-

#include<stdio.h> 

int main()

{

int *ptr1, *ptr2;

int num;

printf("\nEnter two numbers : ");

scanf("%d %d", ptr1, ptr2);

num = *ptr1 + *ptr2;

printf("Sum = %d", num);

return (0);

}

 


Output:

Enter two numbers : 2 3

Sum = 5

No comments:

Post a Comment

google-site-verification: google18ae80885fc3d876.html