Friday, November 20, 2009

Will this program compile? If yes what will be output and why? If not error plz.
void main( )
{

int k=6;
printf ( "k%d" , printf( "%d" , k) ) ;
}

What will be out put of this program:
main( )

{

int i=3, j=0;

if( i==3 && j++ )

printf("%d %d",i , j ) ;

else

printf("%d %d ", i , j ) ;

}

Also Give explaination.

Thursday, November 19, 2009

What will be output: (explain why?)

void main()

{
int a=10,b=300;
char x=1, y=0;
if(a,b,x,y)
printf("Delhi");

else

printf("Mumbai");

}

Thursday, February 14, 2008

Indexing of array elements

Can we use char/float variable for indexing of array elements? For ex,
int arr[10];

arr[ j ] =3;
whether j can be of type char or float?

Thursday, January 31, 2008

C prog to find remainder of a number

This prog finds remainder of a number without using divisor (/), modulus (%) or multiplication (*) operator.

#include
#include
main()
{
int a,b;

printf("enter the value of Dividend=");
scanf("%d",&a);
printf("enter the value of divisor=");
scanf("%d",&b);
if(a>=b)
{
while(a-b>=b)
{
a=a-b;
}
printf("the reminder is =%d",a-b);
}
else
printf(" Dividend must be greater than divisor");
getch();
}

Tuesday, January 29, 2008

C prog to find remainder of a number

A C prog to find remainder of a number without using division (/) or modulus (%)operator.

Friday, January 25, 2008

C prog without a single Semicolon

Yes why not, we can absolutely write a C prog without using a semicolon and having at least one
executable statement.
main()
{

if(printf("hello suriya"))

{
}
}
Another way. (here notice the use of comma operator described in previous post)
main()
{
while(printf("hello suriya"),0)
{
}
}