top of page

#include<stdio.h>

#include <stdarg.h>

#include <time.h>

int result=1;

int numbers;

void asalMi(int parametreSayisi,...);

int main(void){

 

void (*fonkPtr)(int,...)=asalMi;

 

srand(time(NULL));

 

printf("***************  4 ARGUMENTS FUNCTION  ********************\n\n\n");

 

asalMi(4,rand()%90+10,rand()%90+10,rand()%90+10,rand()%90+10);

 

 

printf("\n\n***************  5 ARGUMENTS FUNCTION  ********************\n\n");

asalMi(5,rand()%90+10,rand()%90+10,rand()%90+10,rand()%90+10,rand()%90+10);

 

return 0;

}

 

void asalMi(int parametreSayisi,...){

va_list parametrePtr;

va_start(parametrePtr,parametreSayisi);

 

int i,j;

 

 

printf(" ------NONEPRIME NUMBERS----- | ------PRIME NUMBERS------\n\n");

 

for(i=0;i<parametreSayisi;i++){

numbers=va_arg(parametrePtr,int);

int result=1;

for(j=2;j<=numbers/2;j++){

if(numbers%j==0){

result=0;

break;

}

}

if(result==0)

printf("parametre %d :%d  -> asal deil |\n",i,numbers);

if(result==1)

printf("\t\t\t\tparametre %d :%d  -> asal \n",i,numbers);

}

 

va_end(parametrePtr);

 

 

}

 

bottom of page