hari


{ City } mathura
< Country > india
* Profession * student
User No # 56395
Total Questions Posted # 0
Total Answers Posted # 8

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 40
Users Marked my Answers as Wrong # 12
Questions / { hari }
Questions Answers Category Views Company eMail




Answers / { hari }

Question { HCL, 16264 }

fn f(x)

{ if(x<=0)
return;
else f(x-1)+x;
}


Answer

ans is 16384

for further queries and discussions, just check these out !!!

http://forum.campusmaniac.com/
http://www.campusmaniac.com/

Is This Answer Correct ?    1 Yes 1 No

Question { Satyam, 11448 }

how to find the largest element of array without using relational operater?


Answer

/*
find a largest number out of an given array without
using relational operators
*/

#include
int f(int m,int n)
{if(!(m/n)) return n;

else return m;
}

int main()
{
int a[100],n=0,i,j;
scanf("%d",&n); // length of array (max 100)
for( i=0;i scanf("%d",&a[i]);
int s=a[0];
a[n+1]=0;
for( j=1;j {
if(f(a[j],s))
s=a[j];
}
printf("%d",s);
return 0;
}



for further queries and discussions, just check these out !!!

http://forum.campusmaniac.com/
http://www.campusmaniac.com/

Is This Answer Correct ?    1 Yes 2 No


Question { Infosys, 21294 }

write a c program to print "Welcome" without using semicolon
in the whole program ??


Answer

main()
{
if(printf("Welcome"))
{}
}

for further queries and discussions, just check these out !!!

http://forum.campusmaniac.com/
http://www.campusmaniac.com/

Is This Answer Correct ?    6 Yes 2 No

Question { 5519 }

Is main() is used in the program,,see below example?

void main()
{
int i;
for(i=0;i<10;i++)
main();
}

Then what is the output of the program?


Answer

it will go into an infinite loop.
cheers !!!

for further queries and discussions, just check these out !!!

http://forum.campusmaniac.com/
http://www.campusmaniac.com/

Is This Answer Correct ?    2 Yes 0 No

Question { 8026 }

Write a program using bitwise operators to invert even bits of
a given number.


Answer

#include
int main()
{
int n,n2;
printf("enter the no. < 15 "); // here i am considering the case of 4 bits. (1111) binary = (15) decimal
scanf("%d",&n);
n2=n^10;

/*
10 = 1010 in binary form, to invert its even bits , we will
use bit wise XOR (^) operator
1010 has 1 at its even places, so it will invert the even bits of n.
if there is any further problem mail me at
buntyhariom@gmail.com
www.campusmaniac.com
*/
printf("\n%d",n2);

return 0;
}

Is This Answer Correct ?    10 Yes 2 No

Question { 5629 }

In C program, at end of the program we will give as "return 0"
and "return 1", what they indicate? Is it mandatory to specify
them?


Answer

yeah....... its necessary to return some value if the return type of main() is 'int'.
in fact we can return any valid integer.
here are few examples... all are correct;;;;;;>

return 0;
return 1;
return 100;
return -3;
return 'c';

Is This Answer Correct ?    5 Yes 0 No

Question { 4471 }

what is the answer for it
main()
{
int i;
clrscr();
printf("%d",&i)+1;
scanf("%d",i)-1;
}


Answer

it will print a garbage value..

for further queries and discussions, just check these out !!!

http://forum.campusmaniac.com/
http://www.campusmaniac.com/

Is This Answer Correct ?    2 Yes 1 No

Question { 6441 }

write a programe to find the factorial of given number
using recursion


Answer

int fact(int n)
{
if(n==1)
return 1;
else
return(n*fact(n-1));
}

for further queries and discussions, just check these out !!!

http://forum.campusmaniac.com/
http://www.campusmaniac.com/

Is This Answer Correct ?    13 Yes 4 No