Home / C / C Program for Add two Numbers Using Pointers without Operators

C Program for Add two Numbers Using Pointers without Operators

C Program for Add two Numbers Using Pointers without Operators | C program to  sum up two nos
This is the simple c program which takes two numbers as input and give addition of those number as output. this program doesn’t use any operator for that purpose. 

Program 1: C program to add two numbers using pointers | Without using operators 

#include <stdio.h>
#include <conio.h>
void main()
{
int a,b,sum;
char *p;
clrscr();
printf("Enter 2 values : ");
scanf("%d%d",&a,&b);
p = (char *)a; // Using pointers
sum = (int)&p[b];
printf("\nSum : %d",sum);
getch();
}

Program 2:

#include"stdio.h"
#include"conio.h"

void main()
{
int a,b,sum;
char *p;
clrscr();
printf("Enter 2 values : ");
scanf("%d%d",&a,&b);
printf("\nResult is: %d",printf("%*c%*c",a,' ',b,' '));
getch();
}

Output:

tags: C program for addition of two numbers without using operators, addition on number, C program,without Operator addition, Operator less addition, C program to add two numbers using pointers

Check Also

Restrict Mouse Pointer Position C Graphics Program

This C Program will restrict the Mouse Pointer location or to a particular position or x,y ...

One comment

  1. Please explain how this works.

Leave a Reply

Your email address will not be published. Required fields are marked *

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.