when user give a number it multiply with 9 without
useing '+' and '*' oprator

Answer Posted / vaibhav nigam

/*
your answer is quite correct but its better to use
r=-r; instead of r=abs(r);

well i would have done it like :

*/

#include <iostream>
using namespace std;
int main()
{
int k;
cin >> k;
k=(k<<4)-(k<<2)-(k<<1)-k;
cout << k << endl;
return 0;
}

//here no loop is used..

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to count no of words,characters,lines in a paragraph.

3912


What is p in text message?

544


What is a null pointer in c?

602


all c language question

1878


How can a number be converted to a string?

611






How do shell structures work?

575


Explain what is wrong in this statement?

639


What is the use of ?

628


Why is c fast?

612


How can I make sure that my program is the only one accessing a file?

685


Simplify the program segment if X = B then C ← true else C ← false

2590


Is calloc better than malloc?

584


What are conditional operators in C?

630


Why c is a procedural language?

587


Explain that why C is procedural?

662