Powered by Blogger.

Search

Saturday, 13 December 2014

Print very next and previous 5 numbers of the integer entered.




//This programme is tested on visual studio 2012//
#include <iostream>

using namespace std;

void main()

{

    int num,n_num,temp;
cout<<"------------------------------------------------------------------------------\n";
cout<<"This programme will print very next and previous five numbers of integer entered.\n";
cout<<"------------------------------------------------------------------------------\n";
    cout<<"Enter number : ";

    cin>>num;

    cout<<"Next five numbers are : \n"<<"\t \t";

    temp=num;

 

    for (int i=0;i<5;i++)

    {

        n_num=temp+1;

        cout<<n_num<<":";

        temp=n_num;

    }

    cout<<endl;

    cout<<"--------------------------------------------------------------\n";

cout<<"Previous five numbers are : \n"<<"\t \t";



for (int j=0;j<5;j++)

    {

        n_num=num-1;

        cout<<n_num<<":";

        num=n_num;

}

cout<<endl;

cout<<"--------------------------------------------------------------\n";

cout<<endl;

}
cout<<"\n\n------------------------------------------------------------------------------\n";
    cout<<"Thank You for using.\n\nVisit http://bilalzahid22.blogspot.com/ for more\n";
  cout<<"\n------------------------------------------------------------------------------\n";
}

Ditulis Oleh : Unknown // 02:27
Kategori:

0 comments:

Post a Comment

Translate