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

Why doesn't C support function overloading?

2169


PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM

1954


What is pivot in c?

761


write a c program to calculate sum of digits till it reduces to a single digit using recursion

3000


What is a pointer and how it is initialized?

826


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

959


What is 1d array in c?

848


Do you know what are bitwise shift operators in c programming?

835


Explain logical errors? Compare with syntax errors.

825


What is the ANSI C Standard?

1005


int i=10; printf("%d %d %d", i, i=20, i);

1302


How can I find the modification date of a file?

950


Why main is used in c?

827


What is the difference between far and near in c?

805


Is a pointer a kind of array?

839