Monday, 25 June 2012


C program to reverse a string using recursion


#include<stdio.h>
#include<string.h>
 
void reverse(char*,int,int);
 
main()
{
   char a[100];
 
   gets(a);
 
   reverse(a, 0, strlen(a)-1);
 
   printf("%s\n",a);
 
   return 0;
}
 
void reverse(char *x, int beg, int end)
{
   char a, b, c;
 
   if ( beg >= end )
      return;   
 
   c = *(x+beg);
   *(x+beg) = *(x+end);
   *(x+end) = c;
 
   reverse(x, ++beg, --end);
}



output:
       

Detailed process for getting Migration Certificate from WBUT


Detailed process for getting Migration Certificate from WBUT ( as experienced on 25-06-2012)

1. Docs to carry: original registration card + original & xerox of last sem report card (mark sheet).

2. Goto the bank (Indian Bank) adjoining WBUT
- pay Rs 20/= and collect a migration form
- get a chalan from the bank as well ( 4 counterfoils)

3. Fill in and get the migration form attested by a gazetted officer/your college principal

4. Take the completely filled and attested form and challan to the ground floor office of WBUT. An officer will verify the docs.

5. Goto the fincance dept. in 1st floor (room 107). They will stamp the challan.

6. Goto the Bank (Indian Bank) and pay the amount Rs 300 (urgent -  1 week delivery) ar normal Rs 200 in Cash(20days). The Bank will return 2 copies of the counterfoil.

7.Go back to the ground floor WBUT office
 -they will retain your original registration card, xerox of last sem report card, migration form & their copy of challan
- and give you back a copy of the challan (4th counterfoil).

8.The migration certificate can be collected from wbut office
- in 1 week's time for urgent requirement (Rs 300)
- in 20 days through normal procedure (Rs 200)

The officers and staff were very helpful.

Sunday, 24 June 2012

Write a c program to find GCD of two/three numbers using recursion?


#include<stdio.h> 
#include<conio.h> 

int GCD (int a,int b) 

if (a<0) 
a= -a; 
if (b<0) 
b= -b; 
if (a==0 || b==1 || a==b) 
return b; 
if (a==1 || b==0) 
return a; 
if (a>b) 
return GCD (b, a%b); 
else
 return GCD (a, b%a); 


void main() 

int x,y; 
clrscr(); 
printf("nEnter 1st number:"); 
scanf("%d",&x); 
printf("nEnter 2nd number:"); 
scanf("%d",&y); 
printf("\nGCD is:%d", GCD(x,y)); 
getch(); 




And for three number: 

int GCD3 (int x,int y, int z) 

return GCD(x,GCD(y,z)); 
}


Friday, 22 June 2012


Fibonacci series using Recursion



#include<stdio.h>
#include<conio.h>
int fibonacci(int);
main()
{
int n, i = 0, j;
printf(" Enter the number of terms");
scanf("%d",&n);
printf("First 10 terms of fibonacci series are :\n");
for ( j = 1 ; j <= n ; j++ )
{
printf("%d\n", fibonacci(i));
i++; 
}
return 0;
}
int fibonacci(int n)
{if ( n == 0 )
return 0;
else if ( n == 1 )
return 1;
else
return ( Fibonacci(n-1) + Fibonacci(n-2) );
}

Output Of Program