Adobe Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

In devc++ code can be:


void change2text(long long num, char*text[5],int i)
{
if(!num)
return;
int d;
d = (num%100);
change2text(num/100,text,i+1 == 5?1:(i+1));
cout<<" "<<d<<" "<<text[i];

}

int main()
{
char *text[5] = {"","shata","hajar","lakh", "kuti"};

long long num =0;
int n,i=0;
cout<<"\nEnter the number : ";
cin>>num;
change2text(num,text,0);
getch();
}

- Anonymous September 07, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

@above check for the above test cases carefully not working for 45897458973958
my code:

/****Bangla numbers
====== =======
Bangla numbers normally use 'kuti' (10000000), 'lakh' (100000), 'hajar' (1000),
'shata' (100) while expanding and converting to text. You are going to write
a program to convert a given number to text with them.

Input
-----
The input file may contain several test cases. Each case will contain a
non-negative number <= 999999999999999.

Output
------
For each case of input, you have to output a line starting with the
case number with four digits adjustment followed by the converted text.

Sample Input
------ -----
23764
45897458973958

Sample Output
------ ------
1. 23 hajar 7 shata 64
2. 45 lakh 89 hajar 7 shata 45 kuti 89 lakh 73 hajar 9 shata 58
* 
****
*/
#include<stdio.h>
#include<stdlib.h>


void bangla_numbers(char**arr,int current_index,long long number)
{
	int rem=0;
	if(number==0)
	   return;
	else
	{
	  if(current_index==0) 	
		{
		  rem=number%10;
		  number=number/10;	
		  bangla_numbers(arr,1,number);
		  printf("%d %s ",rem,arr[current_index]);
		}
	   else
	   {
		  rem=number%100;
		  number=number/100;	
		  bangla_numbers(arr,current_index+1==4?0:current_index+1,number);
		  printf("%d %s ",rem,arr[current_index]);
	   }	
		
	}   
	
	
	
}

int main()
{
  char *text[4] = {"shata","hajar","lakh", "kuti"};	
  long long number=23764;
  //long long number=45897458973958;
  int rem=number%100;
  number=number/100;
  bangla_numbers(text,0,number);	
  printf("%d",rem);	
  return 0;	
}

- ankit September 08, 2010 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More