Monday 21, May 2012
Welcome Guest, Register | Login  
      Home    |    Tutorials    |    Free Ebooks    |    Free Scripts    |    Articles    |    Blog     |    About Us    |    Contact Us

  Program to reverse a 2 digit number

This program will reverse a two (2) digit number. Input number must be of 2 digits.
Cut & Paste Script
#include<iostream.h>
void main()
{
    int n;
    cout << "Enter a 2 digit number : ";
    cin >> n;
    if(n<=0 || n>99)
        cout<<"!!! Invalid Number !!!"<<endl;
    else
    {
        int n2 , n3;
        n2 = n % 10;
        n3 = n / 10;
        cout << "You Entered :  "<< n3<<n2<<endl;
        cout << "The reverse of that no is : "  << n2<<n3<<endl;
    }
}

Output:
Enter a 2 digit number : 61
You Entered :  61
The reverse of that no is : 16
Press any key to continue
 
   
     RELATED SCRIPTS
 
Sorting numbers using selection sort in c++
Here is a program example to read a list of integer numbers from keybord and prints them in sorted order. This program is using selection sort to order the integers....more »
Category : C++ Programs Hits : 1492
   
program to print a rectangle of "*"
The following program forms a rectangle of "*"
(Length and width of rectangle entered by user)...more »
Category : C++ Programs Hits : 992
   
Creating an array of objects using c++

Here is a program example to show how to declare an array of an object and use of array of an object.

...more »
Category : C++ Programs Hits : 1532
   
printing current date and time using c++
An example to print current date and time using c++....more »
Category : C++ Programs Hits : 684
   
printing date of birth using structures in c++
printing date of birth using structures in c language....more »
Category : C++ Programs Hits : 642
   
   
SCRIPT CATEGORIES
 
  C Programs
C Programs scripts
  C++ Programs
C++ Programs scripts
  Java Programs
Java Programs scripts
  JavaScript Examples
JavaScript Examples scripts
  PHP Examples
PHP Examples scripts
  VBScript Examples
VBScript Examples scripts
 
 
 
POPULAR E-BOOKS
 
Download Building Skills in Object-Oriented Design - Step-by-Step Construction of A Complete Application  Ebook Building Skills in Object-Oriented Design - Step-by-Step Construction of A Complete Application
   
Download Introduction to Programming (in Java) - An Interdisciplinary Approach  Ebook Introduction to Programming (in Java) - An Interdisciplinary Approach
   
Download Restore Your Computer in a Few Minutes Ebook Restore Your Computer in a Few Minutes
   
Download Programmed Lessons in Quick Basic  Ebook Programmed Lessons in Quick Basic
   
Download Dotcomology Ebook Dotcomology
   
 
Studiesinn.com © 2012 All Rights Reserved.
Website Designed & Developed by TechXprtz