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 process of writing the null pointer?

0 Answers  


what is computer

4 Answers  


can we have joblib in a proc ?

0 Answers  


Explain the array representation of a binary tree in C.

0 Answers   Genpact,


Can include files be nested? How many levels deep can include files be nested?

0 Answers   Aspire, Infogain,






What does c mean?

0 Answers  


write a program to insert an element at the specified position in the given array in c language

5 Answers   Appin, IBM,


What functions are in conio h?

0 Answers  


Difference between Class and Struct.

13 Answers   Ericsson, Motorola, Wipro,


what are the languages used in c#?

3 Answers   Infosys,


what is void pointer?

2 Answers  


write a program to convert a expression in polish notation (postfix) to inline (normal)

0 Answers   Siemens,


Categories