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

Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.

3 Answers   TCS, Vimukti Technologies, Wipro,


. Remove all the blank spaces between character.Matrix is of 10* 10. eg: INPUT ------------------------------------ | N | A | | V | |T ------------------------------------- | |G | U | |P | -------------------------------------- |T | | | A | | ------------------------------------ OUTPUT: ------------------------------------ | N | A | V | T | | ------------------------------------- |G |U | P | | | -------------------------------------- |T | A | | | | ------------------------------------

2 Answers   Nagarro,


Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++

0 Answers  


hello friends, given an expression we have to remove the unwanted brackets in that expression. Eg : (a+b) ---> a+b (a+b)*(c)-----> (a+b)*c. Please mail me if you know the logic. My mail id is : saravana6m@gmail.com. Thank you in advance :-)

1 Answers   GrapeCity, Microsoft,


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

3 Answers   TCS,






write a program to sort 'n' elemnts using bubble sort

1 Answers   IBM,


Write a function- oriented to convert the input dollar(s) into its equivalent peso. Assume that one dollar is equivalent to 51.60

1 Answers  


Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37

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,


An array of size 5X5 is given to us. The elements from 1 to 25 are to be inserted in the array, such that starting from a particular position for an element i, the next element i+1can be inserted only at the mentioned positions (u,v), and if these all positions are occupied then it returns giving a count of how many positions have been occupied in the array: (u,v) = (x+/-3 , y) (u,v) = (x , y+/-3) (u,v) = (x+/-2 , y+/-2). Example: if the starting element is 1 with the given positions (1,2), then next element 2 can be placed at any one of the positions marked with *. _ _ _ _ _ 1 _ _ _ * _ _ _ _ _ _ _ * _ _ * _ _ _ _

0 Answers   Nagarro,


Subsets Write an algorithm that prints out all the subsets of 3 elements of a set of n elements. The elements of the set are stored in a list that is the input to the algorithm. (Since it is a set, you may assume all elements in the list are distinct.)

1 Answers   CSC, Qatar University,


create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file

0 Answers   HCL,


Categories