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
Write a c program to demonstrate character and string constants?
What is meant by type casting?
What is the use of c language in real life?
How does #define work?
Why do we need a structure?
Does * p ++ increment p or what it points to?
How can I swap two values without using a temporary?
What is exit() function?
Explain what are global variables and explain how do you declare them?
What is a ternary operator in c?
What is the purpose of type declarations?
What is the difference between Printf(..) and sprint(...) ?
What are categories used for in c?
Differentiate between ordinary variable and pointer in c.
string reverse using recursion