Showing posts with label Sum and Difference of Two Numbers Using Pointers in C. Show all posts
Showing posts with label Sum and Difference of Two Numbers Using Pointers in C. Show all posts

Tuesday, November 27, 2018

Sum and Difference of Two Numbers Using Pointers in C

A simple program that I wrote using C language that will ask the user to give two numbers and then the program will compute the sum and difference of the two numbers using pointers in C.

I am currently accepting programming work, it projects, school 

programming projects, thesis and capstone projects, IT consulting 

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

My personal website is http://www.jakerpomperada.com


Sample Program Output


Program Listing

/* add_subtract.c
   Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
   Date     : November 27, 2018  Monday  9:21 PM
   Location : Bacolod City, Negros Occidental
   Tool     : Dev C++ Version 5.11
   Website  : http://www.jakerpomperada.com
   Email    : jakerpomperada@jakerpomperada.com and jakerpomperada@gmail.com
*/
#include <stdio.h>
 
int main()
{
   int first=0, second=0;; 
   int *a,*b;
   int sum=0;
   int difference=0;
   printf("\n\n");
   printf("\tSum and Difference of Two Numbers");
   printf("\n\n");
   printf("\tGive Two Numbers : ");
   scanf("%d%d",&first,&second);
   a = &first;
   b = &second;
  sum = (*a + *b);
  difference = (*a - *b);
  printf("\n\n");
  printf("\t===== DISPLAY RESULTS =====");
  printf("\n\n");
  printf("\tThe sum of %d and %d is %d."
          ,first,second,sum);
  printf("\n\n");   
  printf("\tThe difference between %d and %d is %d."
          ,first,second,difference);     
  printf("\n\n");
  printf("\tEND OF PROGRAM");
  printf("\n\n");
 }