5. WAP to multiply two numbers by using addition

Posted: August 26, 2012 in CSE Sem1, Lab 7
#include<stdio.h>
int main()
{
	int a,i,b,ans=0;
printf("Enter first number:");
	    scanf("%d",&a);
    printf("Enter Second number:");
	    scanf("%d",&b);
	for(i=0;i<b;i++){
	ans+=a;
	}
printf("%d",ans);
return 0;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s