| | |
multiply using << several times
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2008
Posts: 32
Reputation:
Solved Threads: 1
If you want to multiply any number by 100
Try this :-
if u want to multiply by n just replace 100 with n.
But BEWARE this works when n is even only.
Find by yourself how to overcome this when n is odd.
Try this :-
CPP Syntax (Toggle Plain Text)
int result = 0; int x; cout << "Enter Any Number " << endl; cin>>x; for ( int i = 1 ; i <= (100 /2) ; i++) { result += x << 1; }
if u want to multiply by n just replace 100 with n.
But BEWARE this works when n is even only.
Find by yourself how to overcome this when n is odd.
Last edited by Ahmed_I; Jun 1st, 2009 at 1:51 pm.
•
•
•
•
COOOOOOOOOL, dont be dick dude, im a begineer. btw sick avatar, what are you 12?
whatever, if you're a beginner, then don't use this site to give wrong advice to other beginners. a good intention is no substitute for correct code.
.
Last edited by jephthah; Jun 1st, 2009 at 1:59 pm.
![]() |
Similar Threads
- Square root program without sqrt or pwr (C++)
- How do I? Edit Crontab using a Script? (Shell Scripting)
- Hex Addition Help (C++)
- need help here... (Assembly)
- cstdio input? (C++)
- Need help with Data Structure and Algorithms (C)
- After Instal GNU/Linux Fedora Core 6 show HZ? (IT Professionals' Lounge)
- Motorola T720 Phone and Verizon Wireless (Cellphones, PDAs and Handheld Devices)
- opcode and instructions in bits (C++)
- Help ME (C++)
Other Threads in the C++ Forum
- Previous Thread: help me on this tutorial
- Next Thread: Expression Evaluator
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






