Write a program to implement the fibonacci series
Sum of two numbers without using arithmetic operators
Ex:int a=10;int b=10;int sum=a+b;without using "+" operator calculate sum
Answered by: jintojos
Member Since May-2008 | Answered On : Jul 17th, 2008
void main()
{
int a=10,b=20;
while(b--) a++;
printf("Sum is :%d",a);
}
For two positive numbers:
int main(){
int a = 10;
int b = 10;
printf("%d",a ^ b | ((a & b)<< 1));
return 0;
}
Code
#include<stdio.h> #include<conio.h> main() { int a=20,b=10,c; clrscr(); c=a-~b-1; //it will change the sign of operator truly magic getch(); return 0; }
Sequence of function execution
Printf("%d%d",f1(),f2());what is the sequence of function execution of the above statement. 1. Printf, f1(), f2()2. Printf, f2(), f1()3. F1(), f2(), printf4. F2(), f1(), printf.
Answered by: mohinuddinkhan
View all answers by mohinuddinkhan
Member Since Oct-2009 | Answered On : Oct 30th, 2009
Let's understand this by going through the following code
#include<stdio.h>
int f1();
int f2();
void main()
{
printf("%dt%d",f1(),f2());
}
int f1()
{
printf("f1() enteredn");
return 4;
}
int f2()
{
printf("f2() enteredn");
return 5;
}
O/P-
f2() entered
f1() entered
4 5
we can conclude f2() is 1st executed
then f1() and in the end printf().hence we can say the precedence of execution of functions are from right to left.
printf();
then f2()
then f1()
then again printf() to print the value in f1 f2
these are arguments to printf function.
3)f1(),f2(),printf
Answered by: Prasad
Answered On : Apr 27th, 2007Constant pointer is NOT pointer to constant. Constant pointer means the pointer is constant. For eg:
Constant Pointer
int * const ptr2 indicates that ptr2 is a pointer which is constant. This means that ptr2 cannot be made to point to another integer. However the integer pointed by ptr2 can be changed.
Where as a Pointer to constant is
const int * ptr1 indicates that ptr1 is a pointer that points to a constant integer. The integer is constant and cannot be changed. However, the pointer ptr1 can be made to point to some other integer.
An ordinary pointer variable preceeded with the "const" modifier. This prevents the value initialised from getting changed.
Absolutely there is the vast difference between constant pointer and the pointer to a constant.it will be more clear with the examples of both the types.CONSTANT POINTER:-int const *a...this means the...
What's the "condition" so that the following codesnippet prints both helloworld !If "condition"printf ("hello");elseprintf("world");
Answered by: kiranb_rvce
View all answers by kiranb_rvce
Member Since Jun-2008 | Answered On : Jun 6th, 2008
if ( ! ( printf("Hello ") ) )
printf("Hello");
else
printf("World");
/* Solution 1: */int main(int argc, char* argv[]){ if( argc == 2 || main( 2, NULL ) ) { printf("Hello "); } else { printf("Worldn"); } return 0;}/* Solution 2 (Only for Unix an...
Is it like this?
void main()
{
int a=2;
while(a--)
if(a)
printf("Hello ");
else
printf("World!");
}
Editorial / Best Answer
Answered by: baseersd
View all answers by baseersd
Member Since Jun-2007 | Answered On : Jul 27th, 2007
limit:5
01123