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
Answer / vadivelt
Do shift the given number left once.
ie., n<<1
Is This Answer Correct ? | 8 Yes | 1 No |
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 |
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 |
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 |
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 |
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 |
An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above
What is true about the following C Functions a.Need not return any value b.Should always return an integer c.Should always return a float d.Should always return more than one value.
1. Duplicate the even numbers. -1 Sample I/O Array1:- 4,2,24,3,22 Updated Array:- 4,4,2,2,24,24,3,22,22 2. Reverse the array in a region - 1 Sample I/O Array1:- 4,2,24,3,22,41,21 Enter Region:- 2,5 Update Array:-4,41,22,3,24,2,21 3. Store first the even digits in an array and then odd digits in same array -2 Sample I/O Array1:- 4,2,24,3,22,41,21 Array 2:- 4,2,2,4,2,2,4,2,3,1,1 4. Store the count of the digits in all numbers in an array and print the count. -2 Sample I/O Array1:- 4,2,9,3,7,41,28 Array 2:- 0,1,1,1,2,0,0,1,1,1 1-1;2-1;3-1;4-2;7-1;8-1;9-1 5. Store all palindrome numbers in to another array -2 Sample I/O Array1:- 4,22,9,313,7,141,28 Array 2:- 4,22,9,313,141 6. Arrange the array in such a way that odd numbers come first and then even numbers -1 Sample I/O Array1:- 4,22,9,313,7,141,28 Update Array1:- 9,313,7,141,4,22,28 7. Store into another array by inserting it in the right place - 2 Sample I/O Array1:- 4,22,9,313,7,141,28 Array2:- 4 /4,22 /4,9,22 /4,9,22 ,313 /4,7,9,22 ,313 /4,7,9,22 ,141,313 / 4,7,9,22,28 ,141,313 8. Merge two sorted arrays in a sorted fashion - 3 Sample I/O Array 1:- 3,6,7,9,11,16 Array 2:- 1,2,5,7,20 Array 3:- 1,2,3,5,6,7,9,11,16,20 9. Upadte the array so that an array element is followed by its revere - 1 Sample I/O Array 1:- 13,63,74,9,11,16 Updated Array 1:- 13,31,63,36,74,47,9,9,11,11,16,16 10.Spread the digits of the array in the same array. -1 Sample I/O Array 1:- 13,63,74,9,11,16 Updated Array 1:-1,3,6,3,74,9,1,1,1,6 11.Shift the boundary of array to have only 2 digit numbers. Sample I/O Array 1:- 139,643,74,9,101,126 Updated Array 1:- 13,96,43,74,91,11,26 12.Print the largest occuring digit in an array of N numbers. Sample I/O Array 1:- 13,63,74,9,11,16 1 occurs most.
swap 2 numbers without using third variable?
int i; i=2; i++; if(i=4) { printf(i=4); } else { printf(i=3); } output of the program ?
What will the preprocessor do for a program?
can anyone proide me reading material on svit00ef27@yahoo.com please thanx in advance
code for replace tabs with equivalent number of blanks
Why does everyone say not to use gets?
What is the difference between union and structure in c?
Write a code to determine the total number of stops an elevator would take to serve N number of people.
What is page thrashing?