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 dynamic memory allocation?

0 Answers  


What is string length in c?

0 Answers  


What is difference between %d and %i in c?

0 Answers  


How can I access a memory located at certain address?

2 Answers   CSC,


dynamically allocate memory for linear array of n integers,store some elements in it and find some of them

1 Answers  






Why cant I open a file by its explicit path?

0 Answers  


What is binary tree in c?

0 Answers  


f1() { f(3);} f(int t) { switch(t); { case 2: c=3; case 3: c=4; case 4: c=5; case 5: c=6; default: c=0;} value of c?

5 Answers   Geometric Software,


do ne body have any idea about the salary for the we r going to have interview. yup .. u got it right ..i m talking abt NIC.

1 Answers  


write a program to check whether a given integer is a strong number or not? [Hint: 145=1!+4!+5! =1+24+120 =145]

7 Answers   Calsoft,


What are the advantage of c language?

0 Answers  


What is key word in c language?

4 Answers   ABC,


Categories