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

Struct(s) { int a; long b; } Union (u) {int a; long b; } Print sizeof(s)and sizeof(u) if sizeof(int)=4 and sizeof(long)=4

2 Answers   Mascot,


is compiler do read the data line by line or not. ??

6 Answers   LG Soft, Satyam, Tech Mahindra,


Explain how do you list files in a directory?

0 Answers  


Why doesn't C support function overloading?

2 Answers  


wht is the difference between KPO and BPO ?

2 Answers   Accenture, BPO, HCK, HCL, Infosys,






What is the difference between File pointer and Internal Charecter Pointer?

2 Answers   TATA,


Write a programm such that if user enter 11.25 it roundup to 11 but if user enter 11.51 upto 11.99 it will round up to 12 i.e.;convert the floting point value into integer format as explain above..

2 Answers  


What do you mean by a sequential access file?

0 Answers  


1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.

0 Answers  


What is meaning of tree

0 Answers  


how we can say java is platform independent, while we require JVM for that particular Operating System?

3 Answers   Honeywell, TCS,


how to return 1000 variables from functio9n in c?plz give me code also

6 Answers  


Categories