write a C program, given number is double without using addt
ion and multiplication operator?ex:n=6,ans=12,pls send me ans
to goviseenu@gmail.com

Answers were Sorted based on User's Feedback



write a C program, given number is double without using addt ion and multiplication operator?ex:n=6..

Answer / vadivelt

Do shift the given number left once.
ie., n<<1

Is This Answer Correct ?    8 Yes 1 No

write a C program, given number is double without using addt ion and multiplication operator?ex:n=6..

Answer / manoj sharma

You can use left bitwise operator.
Say if your no is n then n<<1 will return n*2.

Is This Answer Correct ?    3 Yes 1 No

write a C program, given number is double without using addt ion and multiplication operator?ex:n=6..

Answer / paramesh

#include<stdio.h>
#include<conio.h>
void main()
{
int a;
printf("Enter the number")
scanf("%d",&a);
printf("%d double number is %d", a,a<<1);
getch();
}

Is This Answer Correct ?    1 Yes 0 No

write a C program, given number is double without using addt ion and multiplication operator?ex:n=6..

Answer / sandeep

#include<stdio.h>
#include<conio.h>
void main()
{
int num;
printf("Enter a floating point value");
scanf("%f",&num);
printf("Given no is %f and twice of number is %f"num,num-(-num));
getch();
}

Is This Answer Correct ?    0 Yes 0 No

write a C program, given number is double without using addt ion and multiplication operator?ex:n=6..

Answer / venu

lol, you can't use bitwise operators on double. can be used
only for integers.

Is This Answer Correct ?    0 Yes 1 No

write a C program, given number is double without using addt ion and multiplication operator?ex:n=6..

Answer / manish soni bca 3rd year jaipu

#include<stdio.h>
#include<conio.h>
void main()
{
int a;
printf("Enter number which you want to
double");
scanf("%d",&a);
printf("THE NUMBER IS %d AND DOUBLE NO IS %
d.",a,a<<1);
getch();//optional to write getch();
}

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Interview Questions

write a c program to find largest number in matrix(in each row,each column, diagonally, and in the whole matrix)? Its urgent.

2 Answers  


1. What is the output of printf("%d") 2. What will happen if I say delete this 3. Difference between "C structure" and "C++ structure". 4. Diffrence between a "assignment operator" and a "copy constructor" 5. What is the difference between "overloading" and "overridding"? 6. Explain the need for "Virtual Destructor". 7. Can we have "Virtual Constructors"? 8. What are the different types of polymorphism? 9. What are Virtual Functions? How to implement virtual functions in "C" 10. What are the different types of Storage classes? 11. What is Namespace? 12. What are the types of STL containers?. 13. Difference between "vector" and "array"? 14. How to write a program such that it will delete itself after exectution? 15. Can we generate a C++ source code from the binary file? 16. What are inline functions? 17. Talk sometiming about profiling? 18. How many lines of code you have written for a single program? 19. What is "strstream" ? 20. How to write Multithreaded applications using C++? 21. Explain "passing by value", "passing by pointer" and "passing by reference" 22. Write any small program that will compile in "C" but not in "C++" 23. Have you heard of "mutable" keyword? 24. What is a "RTTI"? 25. Is there something that I can do in C and not in C++? 26. Why preincrement operator is faster than postincrement? 27. What is the difference between "calloc" and "malloc"? 28. What will happen if I allocate memory using "new" and free it using "free" or allocate sing "calloc" and free it using "delete"? 29. What is Memory Alignment? 30. Explain working of printf. 31. Difference between "printf" and "sprintf". 32. What is "map" in STL? 33. When shall I use Multiple Inheritance? 34. What are the techniques you use for debugging? 35. How to reduce a final size of executable? 36. Give 2 examples of a code optimization.

2 Answers  


can we initialize all the members of union?

2 Answers  


HOW TO HANDLE EXCEPTIONS IN C

8 Answers  


Explain how can a program be made to print the name of a source file where an error occurs?

0 Answers  






What is putchar() function?

0 Answers  


How. To pass the entrance test

1 Answers   Tech Mahindra,


Write a program which has the following seven functions. The functions should be: • main() this calls the other 6 functions • fget_long() a function which returns a long data type from a file • fget_short() a function which returns a short integer variable from a file • fget_float() a function which returns a floating point variable from a file • fprt_long() a function which prints its single, long argument into a file • fprt_short() a function which prints its single, short argument into a file • fprt_float() a function which prints its single, floating point argument into a file. You should use fscanf() to get the values of the variables from the input (the file) and fprintf() to print the values to the other file. Pay attention to using the correct format for each of the data types.

0 Answers  


Linked lists -- can you tell me how to check whether a linked list is circular?

0 Answers  


What does typedef struct mean?

0 Answers  


What is memcpy() function?

0 Answers  


How can I implement opaque (abstract) data types in C? What's the difference between these two declarations? struct x1 { ... }; typedef struct { ... } x2;

2 Answers  


Categories