c1

četvrtak, 12. travnja 2012.

7. Simple C++ Program - Tutorial


#include <iostream>
using namespace std;
int main()
{
    int option=1;
    while(option!=0){
    int number1;
    int number2;
    cout<<"Please enter 2 numbers: "<<endl;
    cin>>number1;
    cin>>number2;
    cout<<"All even numbers between these two numbers are: ";
    for(int i=number1+1;i<number2;i++){
            if(i%2==0){
                 cout<<i<<", ";    
                       }}          
    cout<<endl<<endl;
    cout<<"To exit type 0 , if you want to try again type any other number:";
    cin>>option;
    cout<<endl<<endl;
                }          
    cout<<endl<<endl;
    system("PAUSE");
    return EXIT_SUCCESS;
}


Nema komentara:

Objavi komentar