2. Counting in Lojban, an artificial language developed
over the last fourty years, is easier than in most languages
The numbers from zero to nine are:
0 no
1 pa
2 re
3 ci
4 vo
5 mk
6 xa
7 ze
8 bi
9 so
Larger numbers are created by gluing the digit togather.
For Examle 123 is pareci
Write a program that reads in a lojban string(representing
a no less than or equal to 1,000,000) and output it in
numbers.

Answers were Sorted based on User's Feedback



2. Counting in Lojban, an artificial language developed over the last fourty years, is easier than..

Answer / ts

U can easily do this in c i am writing a code you just make its function by your self.Its easy one

#include<stdio.h>
main()
{
int i=0;
char ptr,d;
char c[20];
do
{
printf(" \n Enter the lujban String whose equivalent number is to be printed \n");
scanf("%s",c);
while(c[i]!='\0')
{

switch(c[i])
{
case'n':printf("0");
break;
case 'p':printf("1");
break;
case 'r':printf("2");
break;
case 'c':printf("3");
break;
case 'v':printf("4");
break;
case 'm':printf("5");
break;
case 'x':printf("6");
break;
case 'z':printf("7");
break;
case 'b':printf("8");
break;
case 's':printf("9");
break;
}
i++;
}
printf(" \nDo you want to continue(Y/N)");
d=getche();

}
while(d=='y'||d=='Y');

}

Is This Answer Correct ?    3 Yes 1 No

2. Counting in Lojban, an artificial language developed over the last fourty years, is easier than..

Answer / abdur rab

#include <stdio.h>

int decimal_from_logban ( char* cp_logban )
{
if ( !strcmp ( cp_logban, "no" ) ) return 0;
if ( !strcmp ( cp_logban, "pa" ) ) return 1;
if ( !strcmp ( cp_logban, "re" ) ) return 2;
if ( !strcmp ( cp_logban, "ci" ) ) return 3;
if ( !strcmp ( cp_logban, "vo" ) ) return 4;
if ( !strcmp ( cp_logban, "mk" ) ) return 5;
if ( !strcmp ( cp_logban, "xa" ) ) return 6;
if ( !strcmp ( cp_logban, "ze" ) ) return 7;
if ( !strcmp ( cp_logban, "bi" ) ) return 8;
if ( !strcmp ( cp_logban, "so" ) ) return 9;
}

void logban_2_decimal ( char* _lojban, int* _decimal )
{
char lojban_array [3];

memset ( lojban_array, '\0', 3 );
if ( ( NULL != _lojban ) && ( '\0' != *( _lojban +
2 ) ) ) {
logban_2_decimal ( _lojban + 2, _decimal +
1 );
strncpy ( lojban_array, _lojban, 2 );
*_decimal = decimal_from_logban (
lojban_array );
} else {
strncpy ( lojban_array, _lojban, 2 );
*_decimal = decimal_from_logban (
lojban_array );
}

}

int main ( int argc, char* argv [] )
{
char number_lojban [] = {"sopareci"};
int number_decimal [8];
int i = 0;

logban_2_decimal ( number_lojban, number_decimal ) ;
printf ( "\nLojban :%s", number_lojban );

printf ( "\nDecimal :" );
for ( i = 0; i < ( strlen ( number_lojban ) / 2 );
i++ )
printf ("%d", number_decimal [ i ] );

return ( 0 );
}

Is This Answer Correct ?    2 Yes 2 No

2. Counting in Lojban, an artificial language developed over the last fourty years, is easier than..

Answer / simi

In java We can do the same as
int getIntValueForString(Stirng str){
if("AB".equals(str))return 0;
.
.
.
.
.
if("rs".equals(str))return 9;
}
public static void main(Stirng [args]){
//get the String as an input from the user
//Call the method to get the int
String intValue = getIntValueForLojbanString(inputString , 0);
}
Stirng getIntValueForLojbanString(String inputString ,
String Value){
int i=0;
String intValue = new intvalue();
if(inputString != null || inputString.length()==0) return
intValue;
else
{
if(Value !=null)
intValue= Value +
getIntValueForString(inputString.chatAt[i]+inputString.chatAt[i+1]).toString();

else
intValue =
getIntValueForString(inputString.chatAt[i]+inputString.chatAt[i+1]).toString();

if(inputString.length()>2)
getIntValueForLojbanString(inputString.subString(i+3) ,
intValue);}
}
}

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Interview Questions

What is operator precedence?

0 Answers  


Is double link list a linear data structure? If Yes, Why?If No, Why?

4 Answers  


Which of the following is not a valid declaration for main ()? 1) int main() 2) int main(int argc, char *argv[]) 3) They both work

2 Answers  


can you explain in brief what is "r+" mode in a file... i know that it si used to read and modify rhe existing content.... but explalanation about the file pointer in "r+" mode i wann to know???????????

2 Answers   Cognizant,


GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)

0 Answers  






Tell us two differences between new () and malloc ()?

0 Answers   Adobe,


How can I read/write structures from/to data files?

0 Answers  


What is the difference between #include and #include 'file' ?

0 Answers  


What are the 4 types of organizational structures?

0 Answers  


You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.

0 Answers  


Explain the concept and use of type void.

0 Answers  


How can I convert a number to a string?

0 Answers  


Categories