Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // tema-or-e5.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- bool prim(int s)
- {
- int i;
- for(i=2;i<=s/2;i++)
- if(s%i==0)
- return 0;
- return 1;
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- int n,j=1,i=1,s;
- printf("Dati n: ");
- scanf("%d", &n);
- printf("\n %d %d ",i, j);
- while(n)
- {
- s=i+j;
- if(prim(s)){
- printf("%d ", s);
- n--;}
- i=j;
- j=s;
- }
- scanf("%d",j);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement