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

swap prog

3 Answers   TCS,


. Write a program using two-dimensional arrays that computes the sum of data in tows and the sum of data in columns of the 3x3 (three by three) array variable n[3][3].

2 Answers   IBM,


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,


write a program to perform generic sort in arrays?

0 Answers  


Where now stands that small knot of villages known as the Endians, a mighty forest once stood. Indeed, legand has it that you could have stoodon the edge of the wood and seen it stretch out for miles, were it not for the trees getting in the way. In one section of the forest, the trees stood in a row and were of hight from 1 to n, each hight occurring once and once only. A tree was only visible if there were no higher trees before it in the row. For example, if the heights were 324165, the only visible trees would have been those of height 3,4 & 6. Write a Program that takes an array of integers representing the heights of the trees in the row as input and prints the list of the visible trees.

2 Answers   ABC, Nagarro,






Hello, I am trying to write a program in c++ which accepts month and year from the user and prints the calender. So please tell me the algorithm and what is the calender logic.

0 Answers  


main(){int a=5,b 10,c=2, d;a=b c;d=++a=(--c)*2; printf("%d%d%d%d,a,b,c,d; return o;}

1 Answers  


Write a simple encryption program using string function which apply the substitution method.

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,


Write code for the multiplication of COMPLEX numbers?

0 Answers   IBM,


write a program to calculate the radius for a quadratic equation use modular programming(function abitraction)hint use quadratic function

1 Answers   ICAN, Jomo Kenyatta University,


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,


Categories