Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Numar prim.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- int val;
- int prim(int n)
- {
- bool a;
- _asm {
- mov eax, n
- mov esi, 2 //d
- i_for:
- cmp esi, eax
- ja afara
- mov edx, 0
- div esi
- cmp edx, 0
- jne e1
- mov a, 0
- e1:
- inc esi
- jmp i_for
- afara :
- }
- if (a == 0)
- return 0;
- return 1;
- }
- int main()
- {
- int n;
- printf("n="); scanf_s("%d",&n);
- if (prim(n) == 1)
- printf("Este numar prim\n");
- else
- printf("Nu este numar prim\n");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement