Write A C++ Program To Input A Number Between 20 To 99 And
Display Its Numbername?

Answers were Sorted based on User's Feedback



Write A C++ Program To Input A Number Between 20 To 99 And Display Its Numbername?..

Answer / sudha

#include<iostream>
#include<conio.h>
using namespace std;

int main()
{
string p[] =
{ "","","Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty","Ninety" };
string o[] = { "","one", "two", "three", "four",
"five", "six", "seven", "eight", "nine" };

cout << "\n\nEnter a number between 20 to 99\n";
cin >> n;

i=n/10;
j=n%10;

cout << p[i] <<" " << o[j] << endl;

getch();
return(0);
}

Is This Answer Correct ?    24 Yes 6 No

Write A C++ Program To Input A Number Between 20 To 99 And Display Its Numbername?..

Answer / vinay tiwari

#include<iostream.h>
#include<conio.h>
void main()
{
char a[9][10]=
{"one","two","three","four","five","six","seven","eight","ni
ne"};
char b[8][10]=
{"twenty","thirty","fourty","fifty","sixty","seventy","eight
y","ninety"};
int num,rem;
clrscr();
cout<<"enter number "<<"\n";
cin>>num;
rem=num%10;
num=num/10;
if(rem==0)
cout<<b[num-2]<<"\n";
else
cout<<b[num-2]<<" "<<a[rem-1];
getch();
}

Is This Answer Correct ?    18 Yes 4 No

Write A C++ Program To Input A Number Between 20 To 99 And Display Its Numbername?..

Answer / pavan mustyala

#include<iostream>
using namespace std;

void main()
{
char *arr1[9]=
{"one","two","three","four","five","six","seven","eight","ni
ne"};
char *arr2[8]=
{"twenty","thirty","fourty","fifty","sixty","seventy","eight
y","ninety"};
int num;

cout << "Enter A Number:"<< endl;
cin >> num;

cout << arr2[(num / 10) - 2];

if((num % 10) != 0)
cout << " " << arr1[(num % 10) -1];
}

Is This Answer Correct ?    4 Yes 8 No

Post New Answer

More C++ Code Interview Questions

Deriving time complexity of Binary tree and AVL tree, step by step.

4 Answers   NetApp,


Write an algorithm that receives a string and reverses it.

2 Answers  


How do I store linked list datas into an array?

1 Answers  


Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).

0 Answers   Qatar University,


A research student is given a singly-linked list. Each node of the list has a color, which is either “Black” or “White”. He must find if there are more black nodes than white nodes, or vice versa. His advisor gives him 5,000Rs to buy a computer to do the work. He goes to the computer store and finds a slightly defective computer which costs a mere 3,000Rs. This computer has the small problem of not being able to do arithmetic. This means that he cannot use a counter to count the nodes in the list to determine the majority color. The computer is otherwise fully functional. He has the evil idea that he could buy the defective computer and somehow use it to do his work, so that he can use the rest of the money on enjoyment. Show how he can accomplish this amazing task. Write code for an algorithm called ‘findMajorityColor’ which takes a singly-linked list, L, with n nodes and returns the majority color among nodes of L. This algorithm should have the same asymptotic running time as counting the nodes (O(n)). Note: No arithmetic is allowed.

2 Answers  






write a program that creates a sequenced array of numbers starting with 1 and alternately add 1 and then 2 to create the text number in the series , as shown below. 1,33,4,6,7,9,............147,148,150 Then , using a binary search , searches the array 100 times using randomly generated targets in the range of 1 to 150

0 Answers  


Given 1 to n distinct random number of which n+1th element was duplicated. How do find the duplicate element and explain the time complexity of the algorithm.

0 Answers   Microsoft, NetApp,


i don't know about working of nested for loop can any one help me

0 Answers  


A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect

0 Answers  


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

0 Answers   iGate,


what is the best algorithm to sort out unique words from a list of more than 10 million words(1 crore+)? we need the best technique in the terms of execution time.

9 Answers   TCS,


What will be the output- for(i=1;i<=3;i++) { printf("%d",i); continue; i++; }

5 Answers   Impetus,


Categories