Ravi Kant Pandey
BAN USERRavi Kant Pandey
Research Engineer,
Centre for Development of Telematics
New Delhi110030
INDIA.
EMail:ravi_cdotd@yahoo.co.in
rpandey@cdotd.ernet.in
 » Resume
Work Experience:
September –2005 to Till date
Working as a Research Engineer in
Intelligent Network –Service Control Point(INSCP) Group,
Center for Development of Telematics(CDOT),
Mandi Road, Mehrauli,
New Delhi 110030
Skill Sets:
Protocols: SS7, ANSITCAP
Tools Used: K1297 Protocol Tester (G20), SCENIC
Programming Language: C++, C, Pro C
Database: Oracle
Software Packages: Frame Maker, MS Office
Operating System: HPUNIX, Windows98/XP
Education :
B. Tech. (Computer Science & Engineering) 20012005
Aggregate percentage – 74.2 %
Kamla Nehru Institute of Technology, Sultanpur , U.P.
10+2th
Aggregate percentage – 71.2 %
Uttar Pradesh Board
Khair Inter College, Basti, U.P.
10th
Aggregate percentage – 72.8 %
Uttar Pradesh Board
Khair Inter College, Basti, U.P.
Project Undertaken:
1.Wireless Intelligent Network (WIN)  SCP for BSNL:
1.1 PrePaid Charging(PPC) for Wireless Intelligent Network
Overview:
PPC allows the subscriber to pay for voice telecommunication services prior to usage. A PPC subscriber establishes an account with the service provider to access voice telecommunication and SMS services. The PPC Subscriber may be notified about the account information at the beginning during or at the end of the voice telecommunications services. When the account balance is low, the subscriber use of voice telecommunication services may be deauthorized.
Core Features:
? Balance and Validity Enquiry
? Recharging of Account
? Language Preference
? Account Transaction (Balance Transfer, Balance to Validity Conversion and vice versa)
Subscribed Features:
? Call Forwarding on busy
? Call Forwarding on No answer
? Call Forwarding Default
? Do Not Disturb (DND)
? Selective Call Acceptance (SCA)
Team Size: 7
Project Status: Completed, Enhancement is going on.
Platform: HPUX
Tools: K1297 Protocol Tester
Language used: C, C++, PROC
Database: Oracle
Role: Software Developer
i. Design and coding of Charging for local, intracircle, intercircle calls.
ii. Design, Coding and Testing of User Distribution Algorithm.
iii. Design and coding for One India Plan charging.
iv. Design of new tables to support ONE INDIA PLAN.
v. Updating the schema of existing table to support the One India Plan.
vi. Design Coding and Testing of Balance Transfer.
vii. Design Coding and Testing of Balance to Validity Conversion and vice versa.
 0of 0 votes
AnswersThe function (fopen() and fprintf()) returns EINTR when interrupted by a signal that was caught. We want to test this by sending a signal to interrupt fopen/fprintf when it is called. When should the signal be sent?
 Ravi Kant Pandey Report Duplicate  Flag  PURGE
IBM Software Engineer / Developer Computer Architecture & Low Level  0of 0 votes
AnswersThere are 3 societies a, b, and c. A lent tractors to B and C as many as they had. After some time B gave as many tractors to A and C as many as they have. After sometime c did the same thing. At the end of this transaction each one of them had 24.
 Ravi Kant Pandey
Find the tractors each originally had. Report Duplicate  Flag  PURGE
Infosys Software Engineer / Developer Brain Teasers  0of 0 votes
AnswersThree friends divided some bullets equally. After all of them shot 4 bullets the total no. of remaining bullets is equal to that of one has after division. Find the original number divided.
 Ravi Kant Pandey Report Duplicate  Flag  PURGE
Infosys Software Engineer / Developer Math & Computation  0of 0 votes
Answerstwo link lists starts from head1 and head2 but their some nodes are common as shown below so they end at the same node
 Ravi Kant Pandey
like
abcdef
ghi
xyzw
write an algo to find the first commom element of the list ie g. Report Duplicate  Flag  PURGE
Adobe Software Engineer / Developer Algorithm
last two recursive calls
printPathsRecur(node>left, path, pathLen, ORIGINAL_SUM);
printPathsRecur(node>right, path, pathLen, ORIGINAL_SUM);
will be called many(no of ancester+1) times for the same node
#include<stdio.h>
int main(){
char st[100];
int index=0;
int max=1;
int offset=0;
int midindx=0;
// Input
printf("\nEnter String:");
scanf("%s",st);
//max palindrome of odd length
while(st[index+offset] != NULL){
offset=0;
while((index >= offset) && (st[index + offset] != NULL ) && (st[index + offset] == st[index  offset])){
if(offset>max){
max = offset;
midindx=index;
}
offset++;
}
index++;
}
if(max != 1){
printf("\nMax Odd length palindrome of length %d is : %.*s\n",2 * max +1,2 * max +1, &st[midindxmax]);
}
//max palindrome of even length
int index1=0;
int max1=1;
int offset1=0;
int midindx1=0;
while((st[index1 + offset1] != NULL) && (st[index1 + offset1 + 1] != NULL)){
offset1=0;
while((st[index1 + offset1 + 1] != NULL) && (index1 >= offset1) && (st[index1  offset1] == (st[index1 + offset1 + 1] ))){
if(offset1 > max1){
max1 = offset1;
midindx1 = index1;
}
offset1++;
}
index1++;
}
if(max1 != 1){
printf("\nMax Even length palindrome of length %d is : %.*s\n",2 * max1 + 2,2 * max1 + 2, &st[midindx1max1]);
}
}

Ravi Kant Pandey
May 29, 2007 i think one more check is needed
with if(alph[s2[i]'a']!=0 && Guess?????????)
write inorder and preorder/postorder
these two order traversals uniquely represent the tree.
#include<stdio.h>
#include<limits.h>
typedef enum {
WHITE_SPACE,
GETDIGITS,
FINISHED
} get_state;
typedef enum {
POSITIVE,
NEGATIVE
} get_sign;
int get_int(char * ch){
get_state state = WHITE_SPACE;
get_sign sign = POSITIVE;
int value = 0;
int limit = INT_MAX / 10;
int dig;
if(*ch){
while(state != FINISHED){
dig = (unsigned int)*ch++;
switch(state){
case WHITE_SPACE:
if(dig == ' '){
;
}
else if(dig == '+'){
state = GETDIGITS;
}
else if(dig == ''){
state = GETDIGITS;
sign = NEGATIVE;
}
else if(dig >= '0' && dig <= '9'){
value = dig  '0';
state = GETDIGITS;
}
else{
state=FINISHED;
}
break;
case GETDIGITS:
dig = dig  '0';
if( !( ( dig >= 0 ) && ( dig <= 9 ) ) ){
state=FINISHED;
break;
}
if( value < limit 
( (value ==limit) &&
(((sign == POSITIVE) && (INT_MAX  value * 10 >= dig))
 ((sign == NEGATIVE) && ( INT_MIN  value * 10 >= dig)))) ){
value = value * 10 + dig ;
}
else{
if(sign == NEGATIVE)
value=INT_MIN;
else
value=INT_MAX;
state=FINISHED;
}
break;
case FINISHED:
default:
break;
}
}
}
if( sign == NEGATIVE )
value = value * 1;
return value;
}
int main(){
char str[20];
while(1){
printf("\nEnter Number: ");
fgets(str , sizeof(str),stdin);
fflush(stdin);
printf("\nYou Entered = %d ",get_int(str));
}
}
that is equal to O(max(m,n) time and O(1) space
that is gud.
here is code which takes O(1) space and O(n) time.
#include<stdio.h>
int main(){
char *str="axxxxxxxxxxxxxxdefffffgasdfgafgasdh";
int i=0,j=0,index=0;
int c1=0,cmax=0;
if(str[0]){
c1=1;
cmax=1;
i=1;
}
while(str[i]!=NULL){
if(str[i]==str[j])
c1++;
else{
if(c1 > cmax){
cmax = c1;
index=j;
}
c1=1;
j=i;
}
i++;
}
if(c1>cmax){
cmax=c1;
index=j;
}
printf("\n%d times %c",cmax,str[index]);
}
the above algo posted by me takes O(n*n) time
the following algo takes O(n) time
call this fuction with flag = 1
node * Tree :: convLnLst(node *T,int flag){
node *l1,*l2;
if(T!=NULL){
l1=convLnLst(T>left,0);
l2=convLnLst(T>right,1);
T>left=l1;
T>right=l2;
if(l1!=NULL){
l1>right=T;
}
if(l2!=NULL){
l2>left=T;
}
if(flag==0 && T>right)
return T>right;
if(flag==1 && T>left)
return T>left;
if(flag==1){
while(T>left)
T=T>left;
}
return T;
}
return NULL;
}
hi anonymous,
T
/ \
/ \
A B
where T is the root and A and B are sorted linked list.
u have to join
1.A's last node to T
2.T to B's first node
In your algo
1.l1 holds last node of A
2.l2 also holds last node of B
so you join last node of A to T which is correct
but u join T to last node of B(l2>left=T).
it doesnt solve the purpose.
what u can do is ,
while(l2>left!=NULL)
l2=l2>left;
now it points to the head of the sorted list B
now u can join T to l2
if u have any query
do ask..........
bye
the following code works:
node * Tree :: convLnLst(node *T){
node *l1,*l2;
node * temp;
if(T!=NULL){
l1=convLnLst(T>left);
l2=convLnLst(T>right);
T>left=l1;
T>right=l2;
if(l2!=NULL){
l2>left=T;
}
if(l1!=NULL){
temp=l1;
while(temp>right)
temp=temp>right;
temp>right=T;
l1>left=NULL;
return l1;
}
else
return T;
}
else
return NULL;
}
#include<stdio.h>
int main(){
int a[10]={0,1,1,1,0,0,1,1,1,0};
int i,j,temp;
i=0;
j=0;
while(j<10){
if(a[i]==0){
i++;
j++;
}
else if (a[i]==1 && a[j]==1)
j++;
else if (a[i]==1 && a[j] ==0){
temp=a[i];
a[i]=a[j];
a[j]=temp;
i++;
j++;
}
}
i=0;
for(i=0;i<10;i++)
printf(" %d",a[i]);
}
ques: Suppose we have an array a1,a2,... ,an, b1,b2,..., bn How to change this array to
a1,b1,a2,b2, ...,an,bn in O(n) time and in O(1) space.
Solution:
the position of a0 and bn is fixed and they wont change so we have to replace remaining n2 elements
count=n2;
we strat from 2nd element find its position store the element at that position in temp variable and store 2nd element at that position.
now find the position of the stored temp varible and do as above
but it ends up at the position where u start so
start again from a position which ends up relocationg maximum no of elements.
#include<stdio.h>
#define n 10
int main(){
int a[n];
int count=0,i=1,put,temp,j=0;
int start=1;
for(j=0;j<n;j++)
a[j]=j;
printf("\n\n Elements: ");
for(j=0;j<n;j++)
printf("%d ",a[j]);
put=a[1];
while(count < n2){
count++;
if(i< (n/2)){
temp=a[i*2];
a[i*2]=put;
put=temp;
i=2*i;
}
else{
temp=a[2*(i (n/2))+1];
a[2*(i(n/2))+1]=put;
put=temp;
i=2*(i(n/2))+1;
if(i==start){
start=start+2;
put=a[start];
i=start;
}
}
}
printf("\n\nAfter Reordering: ");
for(j=0;j<n;j++)
printf("%d ",a[j]);
}
its not working when n>62 ie n=64 66 .....
could anyone improve or get another solution......
Great!!!!!!
Looking for the same!!!!!!!!!
#include <stdio.h>
char *arr[][10] = {
{"One ","Two ","Three ","Four ","Five ","Six ","Seven ","Eight ","Nine "},
{"Ten","Eleven ","Twelve ","Thirteen ","Fourteen ","Fifteen ","Sixteen ","Seventeen "," Eighteen ","Nineteen "},
{"Twenty ","Thirty ","Forty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety "},
{"Thousand ","Lacs ","Crore ","Arab "}
};
void represent(int i){ //printing string equivalent of two digit num
int t1,t2;
t1=i/10;
t2=i%10;
if(i>0)
if(i<10)
printf("%s ",arr[0][t21]);
else if(i<20)
printf("%s ",arr[1][t2]);
else{
printf("%s ",arr[2][t12]);
if(t2>0)
printf("%s ",arr[0][t21]);
}
}
void trailthreedig(int num){ //printing string equi of trailing three digits
int t; //of input string
t=num/100;
num=num%100;
if(t != 0){
printf("%s",arr[0][t1]);
printf("Hundred ");
}
represent(num);
}
void numtostring(int num) // a recursive function
{
int i=0;
static int count=0;
if(num==0)
return;
i=num%100;
count++;
numtostring(num/100);
represent(i);
printf("%s ",arr[3][count1]);
count;
}
main()
{
unsigned int num ;
int i;
printf("\n Enter the number string : ");
scanf("%ud " , &num);
printf("\n\nNumber: ");
if(num==0)
printf("Zero");
else{
numtostring(num/1000);
trailthreedig(num%1000);
}
printf("\n\n");
}
find the centers of the squres and draw a line joining them .
 Ravi Kant Pandey April 10, 2007it can be made more efficient:
bool is_prime(int num){
if(num<=3)return true;
if(num%2==0)return false;
for(int i=5; i < sqrt(n);i+=2) //beyond sqrt(n)
if(num%i==0)return false; //no num can
return true; //divide n
}
if previous byte's first bit is one then done.
otherwise go back untill u find one of
1. a byte with first bit zero
2. start of the string
if thr is any problem plz let me know
 Ravi Kant Pandey April 04, 2007suppose there r two sorted arrays
1.A[n+m] where n elements are sorted and there are m
free spaces.
2.B[m] where m elements are sorted.
algo:
1.In array A there are m free spaces .
shift all the elements of array A
so that m free spaces would be in the biggining of
array A. It takes O(m) time
for(i=m+n1;i>=n;i)
A[i]=A[in];
2.now merge arrays A and B and store all the elements in A starting from A[0].
merging includes comparing of elements of A and B and putting smaller element in array A starting from A[0]
i tried it
it works
Hi,
if u have O(n) space you can do it in O(n) run time
traverse preorder the addresses of the nodes and store it.
then traverse inorder the addresses of the nodes and store it.
eg tree
a
b c
d e f
have PreOrder:a b d e c f
Inorder: d b e a c f
for two node ptrs eg d and c
mark the positions in inorder array and find first preorder ptr which seprates it into two
different parts of Inorder array
for above example first preorder ptr is a which seprates inorder into dbe and cf
so a is first commom ancester of d and c
the array size in the program is 100
if u want larger input ,increse array size
it will work.
could u tell me what was input.
 Ravi Kant Pandey April 03, 2007yes using constant memory it can be done.
 Ravi Kant Pandey April 03, 2007hi
this can be doneb by an array.
int SNL[100];
every element of this array contains an integer according to following rule:
1.if there is a ladder starting from x to x+l
then SNL[x]=l;
2.if there is a snake bite at x and leaving you at
xs;
then SNL[x]=s;
otherwise SNL[x]=0;
Hi all,
here is code in C:
#include<stdio.h>
#include<string.h>
int main(){
int len,i,j=0,index,tempindex,count,tempcount;
char str[100],*ptr;
printf("\nEnter String: ");
scanf("%s",str);
len=strlen(str);
ptr=str;
index=0;
count=0;
//finding longest palindrome of odd length
for(i=1;i<len1;i++){
j=1;
while(((ij) >= 0) && ((i+j) < len) && (str[ij]==str[i+j]))
j++;
if(j1>count){
index=i;
count=j1;
}
}
if(count>=1){
index=indexcount;
count=2*count+1;
}
//finding longest palindrome of even length
tempcount=0;
tempindex=0;
for(i=0;i<len1;i++){
j=0;
while(((ij) >= 0) && ((i+j+1) < len) && (str[ij]==str[i+j+1]))
j++;
if(j>tempcount){
tempindex=i;
tempcount=j;
}
}
if(tempcount>0)
{
tempindex=tempindextempcount+1;
tempcount=tempcount*2;
}
//if even palindrome's length is greater than odd palindrome's length
if(tempcount>count)
{
index=tempindex;
count=tempcount;
}
printf("\nindex=%d, count= %d",index,count);
if(count==0)
printf("\nNo Palindrome");
else{
ptr=ptr+index;
ptr[count]=NULL;
printf("\nLongest Palindrome: %s",ptr);
}
}

Ravi Kant Pandey
April 02, 2007 yes using two pointers works well .
other algo may be as follows:
reverse the linked list from .
while reversing if u start from first node.
after starting reversing if u find first node again .
there is loop in linked list.
reverse it again to find original list.
Hi,
this can also be written as:
struct lnlst* reverse(struct lnlst *ls)
{
struct lnlst *temp,*prev,*current;
prev=0;
temp=0;
current=ls;
if(current == NULL)
return;
do
{
temp=current>next;
current>next=prev;
prev=current;
current=temp;
}while(current)
return(prev);
}
if there is any problem plz let me know
Hi
structure of the linklist
struct lnlst{
int info;
struct lnlst *next;
};
function to reverse using iteration:
struct lnlst* reverse(struct lnlst *ls)
{
struct lnlst *temp,*prev,*current;
prev=0;
temp=0;
current=ls;
while(current)
{
temp=current>next;
current>next=prev;
prev=current;
current=temp;
}
return(prev);
}
hi kg
if there is only one node ie root which have no children,then i think above solution will not print the root.
plz comment if i miss sth.
yes i got ur point ...
that for binary search trees inorder traversal is same so we need only preorder or post order traversal.but for a binary tree we need two traversal and one of them must be inorder.
Hi,
starting from the first node,node next to number of nodes which are not in loop is the start of the loop.
yes take two ptr p1 and p2 pointing to the head of the list.
now inrement p1, n1 times pointing to nth node.
now increment both p1 and p2 till p1 points to NULL.
at this point p2 will be pointing to the nth node
from end of the linked list
and after heap construction how cud one find duplicate???????
Plz reply asap.
heap construction will take O(nlogn) time
 Ravi Kant Pandey March 28, 2007Insted of calculating
1*2*....*100
we can calculate 1*1+2*2... 100*100
because
n! > 1*1+2*2 ....n*n for n>4
so n! will take data type with larger range
so we have
s1=SUM(A*A)SUM(B*B)=x*xy*y=(xy)(x+y)..1
and
s2=SUM(A)SUM(B)=(xy) ..2
dividing 1 by 2 we have
x+y= s1/s2 ..3
by 2 & 3rd eqution we find x and y
yes i agree to the contributer
Max heap is better option
for every page there shoud be an ofject of class class page{
int numView;
Ptr ptrSataliteData;
}
initialize all the pages with numView=0;
#define MAX_PAGES 1000
page * maxHeap[1000];
populate the array with the pointers of pages
at starting none of the pages are viewed so they can be initialized in any order
now if any page is viewed
call the function
HEAP_INCREASE_KEY();
and this function will relocate the position of
that page in heap.
at any time the most user viewed page is the top element of heap
that is maxHeap[0];
oh missed one thing again.
current should be initialised
current =1
int current, insert = 1; is replaced by
int current=1, insert = 1;
sorry ,the above wont work
updated:
remove_duplicates(int * p, int size)
{
int current, insert = 1;
while(current < size){
if (p[current] != p[insert1]){
p[insert] = p[current];
insert++;
}
current++;
}
return (insert1); //return the last index of
//array with unique elements
}.
1.insert all elements of set A and B in binary search tree for elements which are only less and greater than the element in the
binary tree.
then traverse it for the Union of A and B.
INSERT(node *ptr,int num){
if(ptr==NULL){
ptr=getnode(num);
return;
}
if(ptr>data <num){ //only smaller
if(ptr>left!=NULL)
INSERT(ptr>left,num);
else
ptr>left=getnode(num);
}
else if(ptr>data >num){ //only larger
if(ptr>right!=NULL)
INSERT(ptr>right,num);
else
ptr>right=getnode(num);
}
}
Now traverse the element and get the union of set A & B
2.if it is known that the elements are between 0 and k [0,k]
then take an array COUNT[k] of size k and initialize the array with 0
then traverse both sets A and B
for every element e in A or B increment COUNT[e] by 1.
now union of A & B is the set of index i such that
COUNT[i]>0;
This solution is not efficient in case k is very large.
3.Suppose A and B are arrays with n1 and n2 elements.
use an array C of size n1+n2.
populate C with the elements of A and B
sort C.
then remove dumplicates and return the index of array C with unique element ie the union of A & B.
int UNION(int C[]){
insert=1; //pointing to second element
current=1; //pointing to second element
while(current<n1+n2){
if(C[current]!=C[insert1]){
C[insert]=C[current];
insert++;
}
current++;
}
return (insert1);
}
2nd solution
Using Iteratin:
#include<stdio.h>
char s[100]="Madan Mohan Malviya";
void main(){
char temp;
int i=0,len=0;
//reversing the whole string
while(s[len])
len+=1;
len =len1;
while(len>i){
temp=s[i];
s[i++]=s[len];
s[len]=temp;
}
//reversing words
int base=0,j;
while(1){
i=0;
while((s[base+i] != ' ') && (s[base+i] != NULL))
i++;
len=i;
i;
j=0;
while(i>j){
temp = s[base+i];
s[base+i]=s[base+j];
s[base+j]=temp;
i;
j++;
}
base=base+len;
if(s[base] == NULL)
break;
base=base+1;
}
printf("\n\n%s\n\n",s);
}
two solutions
1.recursion
2.iteration
Strategy >
first reverse the whole string
then reverse it word by word.
1.recursion:
#include<stdio.h>
char s[100]="Madan Mohan Malviya";
void reverse(char a[]);//to reverse string.
void revword(char a[]);//to reverse word.
void main(){
reverse(s);
revword(s);
printf("%s",s);
}
void reverse(char a[]){
static int i=0;
char x=a[0];
if(x == NULL)
return;
reverse(&a[1]);
s[i++]=x;
}
void revword(char a[]){
static int i=0;
char x=a[0];
if(x == ' ' x == NULL)
return;
revword(&a[1]);
s[i++]=x;
if(s[i]==' '){
i++;
revword(&s[i]); //called when next word appears.
}
}
//loop is detected by reversing the link list now to regain original list it has been reversed once more.
#include<stdio.h>
struct lnlst{
int info;
struct lnlst *next;
};
struct lnlst* reverse(struct lnlst* ,struct lnlst * []);
void main()
{
struct lnlst *ls,*temp,*ptr;
struct lnlst *a[100],*b[100];
int i;
//Preparing a linked list with loop
ls=(struct lnlst*)malloc(sizeof(struct lnlst));
ls>info=15;
temp=ls;
for(int i=0;i<10;i++)
{
temp>next=(struct lnlst*)malloc(sizeof(struct lnlst));
temp=temp>next;
if(i==5)
ptr=temp;
temp>info=i;
}
temp>next=ptr;
// temp>next=NULL;
// link list preparation completed.
//printing link list
temp=ls;
printf("\nData with index:");
for(int i=0;i<30 && temp !=NULL;i++){//15 elements are displayed to include loop
printf("\t(%d)%d",i,temp>info);
temp=temp>next;
}
//printing completed
temp=0;
//reversing first time.
temp=reverse(ls,a);
if(temp==ls)
printf("\nNOTE:There is Loop in the link list");
ls =temp; //it is included to cater if there is no loop.
//reversing second time.
ls=reverse(ls,b);
//printing addresses
printf("\ni a[i] b[i] ");
i=0;
while(a[i] && b[i]){
printf("\n%d %ld %ld\n",i,a[i],b[i]);
i++;
}
//printing addresses completed
//comparing addressed
i=0;
while(a[i]==b[i])
i++;
printf("\n\nLoop starts from node address: %ld at index %d\n",a[i1],i1);
}
struct lnlst* reverse(struct lnlst *ls ,struct lnlst* ar[])
{
struct lnlst *temp,*prev,*current;
int i=0;
prev=0;
temp=0;
current=ls;
ar[i++]=current;
while(current>next)
{
temp=current>next;
current>next=prev;
prev=current;
current=temp;
ar[i++]=current;
}
ar[i]=NULL;
current>next=prev;
return(current);
}
Hi,
take two pts current and insert both pointinfg to 2nd element.
if the element pointed by current is not equal to
the element pointed by (insert1) copy current element
at index insert and increment current and insert
by 1.
otherwise (if both are equal) increment current by 1.
int remove_duplicates(int * p, int size)
{
int current, insert = 1;
for (current=1; current < size; current++)
if (p[current] != p[insert1])
{
p[insert] = p[current];
current++;
insert++;
} else
current++;
return (insert1); //return the last index of
//array with unique elements
}
RepHello friends my name Neha Nanda from India Chandigarh city. Doing work in SEO line in Softsys company.
RepMy name Madhu Nanda from Himachal pardesh. I am a writter in English lectractrue.
RepI am an energetic sales professional with a track record of consistently increasing sales revenue in a competitive market. Contract ...
Open Chat in New Window
Hi,
 Ravi Kant Pandey February 18, 2008As n! = 1*2*3* 4* 5*.... *10* .... *25 *.....125*....*n
We observe every five numbers has one factor of 5 , then every 25 numbers has 1 extra factor of 5 , then every 125 numbers has 1 extra factor of 5 ....
so
int numTrailZeros(int n){
int sum=0;
while(n != 0){
sum=sum + n/5;
n = n/5;
}
return sum;
}
if any problem plz let me know.