#include<iostream>
#include<cstdlib>
using namespace std;
bool first(int n)
{
if (n < 2)
return false;
for (int i = 2; i * i <= n; i++)
if (n % i == 0)
return false;
return true;
}
int main()
{
int up, down,sum;
sum=0;
cout << "Podaj liczbę gorna: ";
cin >> up;
cout << "Podaj liczbę dolna: ";
cin >> down;
for (; down <= up; down++)
{
if (first(down)==true) {
sum+=down;
cout<<"liczba "<<down<<"jest pierwsza\n";
}
}
cout<<sum;
cout<<endl;
system("pause");
return 0;
}
==========================================================================================
#include <iostream>
#include <cstdlib>
#include <windows.h>
using namespace std;
void gotoxy ( int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
int main(int argc, char** argv)
{
for (int i=1;i<=9;i++)
{
gotoxy(2,i);
cout<<"|";
}
for (int i=1;i<=23;i++)
{
gotoxy(i,2);
cout<<"-";
}
for (int i=3;i<=23;i++)
{
gotoxy(3,1);
cout<<" 1 2 3 4 5 6 7";
}
for (int i=1;i<=9;i++)
{
gotoxy(1,3);
cout<<"1\n 2\n 3\n 4\n 5\n 6\n 7\n";
}
for (int i=3;i<=23;i++)
{
gotoxy(3,3);
cout<<" 1 2 3 4 5 6 7";
}
for (int i=3;i<=23;i++)
{
gotoxy(3,4);
cout<<" 2 4 6 8 10 12 14";
}
for (int i=3;i<=23;i++)
{
gotoxy(3,5);
cout<<" 3 6 9 12 15 18 21";
}
for (int i=3;i<=23;i++)
{
gotoxy(3,6);
cout<<" 4 8 12 16 20 24 28";
}
for (int i=3;i<=23;i++)
{
gotoxy(3,7);
cout<<" 5 10 15 20 25 30 35";
}
for (int i=3;i<=23;i++)
{
gotoxy(3,8);
cout<<" 6 12 18 24 30 36 42";
}
for (int i=3;i<=23;i++)
{
gotoxy(3,9);
cout<<" 7 14 21 28 35 42 49";
}
cout<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}