[ create a new paste ] login | about

Link: http://codepad.org/awxC15H7    [ raw code | output | fork ]

C++, pasted on Jul 24:
#include<iostream>
#include <iomanip>
using namespace std;
int main()
{
    int f = 0;
    for (int j = 1; j <= 100; j++)
    {
        f = 0;
        for(int i = 2; i < j && f == 0; i++) 
        {
            if( j % i == 0 ) 
            {
                f = 1;  
                break;       
            }
        }
        if(f == 0)  
            cout<<j<<setw(3);
    }
    cout<<endl;
    cin.get();
    return 0;
}


Output:
1
1  2  3  5  7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97


Create a new paste based on this one


Comments: