Program to accept a 3 digit number and print it out digit by digit as a series of words


    # include <iostream.h>
    # include<conio.h>
    void main( )
    {
    int n;
    char s[10][6]={ "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};
    cout<<"\n Enter 3 digit number : ";
    cin >> n;
    cout<< "\n The Number is : " <<n ;

    cout<<"\n"<<s[n/100];
    n = n % 100;
    cout<<" "<<s[n/10];
    n = n % 10;
    cout<<" "<<s[n/1];
    getch( );
    }

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|