C Programming Examples

Enter two numbers and display their sum without using arithmetic operator.

#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, i,ans;
clrscr();
printf("Enter first number : ");
scanf("%d",&a);
printf("Enter second number : ");
scanf("%d",&b);
ans=a;
for(i=1;i<=b;i++)
ans++;
printf("%d + %d = %d",a,b,ans);
getch();

}

No comments:

Post a Comment