52.write a “Hello World” program in “c” without using a
semicolon?
53.Give a method to count the number of ones in a 32 bit number?
54.write a program that print itself even if the source file
is deleted?
55.Given an unsigned integer, find if the number is power of 2?
Answer Posted / g
54:
you can load the source file to memory at the beginning of
the run using mmap(), or using one of the countless methods
to read from file in C and storing the data in a string
array, then it won't matter if the file is deleted, you can
always re-create it using the data in the process memory.
53/55: answering 53 also answers 55.
53:
int checkBits(x){
numOfOnes=0;
do{
if((x%2)!=0)
{numOfOnes++;}
x=x/2;
}while (x!=0);
return numOfOnes;
}
55:
int checkPower(x){
if(checkBits(x)==1)
{return 1;}
else{return 0;}
}
| Is This Answer Correct ? | 18 Yes | 22 No |
Post New Answer View All Answers
What is gets() function?
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
Explain how can you be sure that a program follows the ansi c standard?
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
Dont ansi function prototypes render lint obsolete?
Difference between MAC vs. IP Addressing
i got 75% in all semester am i eligible for your company
Why main is used in c?
write a program to find out prime number using sieve case?
How can this be legal c?
What is bss in c?
What are header files? What are their uses?
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
Explain what is the stack?
what is the significance of static storage class specifier?