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

Answers were Sorted based on User's Feedback



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

Answer / guest

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{clrscr();
int a,i,r=0;
scanf("%d",&a);

for(i=a;i>0;i--)
r=r-9;
r=abs(r);
printf("%d",r);
getch();
}

Is This Answer Correct ?    4 Yes 2 No

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

Answer / tknowledge05

The above guest is me .. okk....
by the time i solved and executing i was logged out and when i posted the answer it considered guest.......

Is This Answer Correct ?    0 Yes 0 No

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

Answer / tknowledge05

The above guest is me .. okkkk....
by the time i solved and executing i was logged out and when i posted the answer it considered guestt.........

Is This Answer Correct ?    0 Yes 0 No

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

Answer / 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

More C Interview Questions

What is the real time usage volatile?

2 Answers   Polycom,


When we use void main and int main?

0 Answers  


Why is C language being considered a middle level language?

0 Answers  


How can you convert integers to binary or hexadecimal?

0 Answers  


why the execution starts from main function

9 Answers  


Write a program that will read the input of any number of digits n in a row of shafh showing the breakdown of the printing and printing figures by the recursive function.

0 Answers  


cavium networks written test pattern ..

0 Answers   Cavium Networks,


which is an algorithm for sorting in a growing Lexicographic order

0 Answers  


What are enumerated types?

0 Answers  


exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above

0 Answers  


What does c in a circle mean?

0 Answers  


What is putchar() function?

0 Answers  


Categories