• The End Virus - Changes Files Extensions in Windows

"The_End Virus" - which changes files extensions in windows

• Mouse Programming in C - Part 1

Mouse Programming is warranted for all playful and knowledgeable purposes.

• C Assembly Programming - Assembler

Assembly Programming Series by MyCFiles.com

• Graphic Programming in C - Part 1

Graphic Programming By MyCFiles

• Graphics Codes in C

Some awesome Graphics Codes.. Presented by MY C FILES

February 5, 2011

C Program for Multiplication without Using Multiply Operator *

Here is another program from the series tricky code. Here I am going to show you how we can do Multiplication without using Multiply Operator *. Programs like this you will rarely get anywhere else.

Comment below to express your feeling  and suggest me new idea for more tricky code.

Logic of the code:

First you give a try to think the logic.

Let a and b are two variables then c=axb. We take 9 as a and 8 as b then c=72.

In other word we are adding 9, 8 times or adding 9, 8 times,  so simple logic. This is what I converted into programing.

Code:

//C Program for Multiplication without Using Multiply Operator *
#include<stdio.h>
#include<conio.h>
void main()
{
int n,m,s=0;
clrscr();
printf("\nEnter the values");
scanf("%d%d",&n,&m);
while(m!=0)
{
s=s+n;
m--;
}
printf("Result = %d",s);
getch();
}

C Program to Print HELLO without HELLO

Hope you liked my posts, give comments if you have any doubts.. :)

Categories: ,