Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Parallel Processing ProgramsRSS Feeds

PROGRAM TO FIND THE FACTORS OF GIVEN NUMBER PARALLELY

Posted By: Luann Schmidt     Category: C Programming     Views: 4056

PROGRAM TO FIND THE FACTORS OF GIVEN NUMBER PARALLELY.

Code for PROGRAM TO FIND THE FACTORS OF GIVEN NUMBER PARALLELY in C Programming

#include <stdio.h>
#include "forkjoin.h"
#include "shared.h"int main()
{
      int n,nproc,pid;
      printf("Enter the number : ");
      scanf("%d",&n);
      nproc = n/2;
      printf("Factors of the Given Number are : \n");
      pid = create_process(&nproc);
      if(n%(pid+1) == 0)
         printf("%d\n",pid+1);
      join_process(&nproc,&pid);
     return 0;
}

/**************************************************************************

               :: OUTPUT ::

Enter the number : 20

Factors of the Given Number are : 
1
2
4
10
5
  
Share: 


Didn't find what you were looking for? Find more on PROGRAM TO FIND THE FACTORS OF GIVEN NUMBER PARALLELY Or get search suggestion and latest updates.

Luann Schmidt
Luann Schmidt author of PROGRAM TO FIND THE FACTORS OF GIVEN NUMBER PARALLELY is from Frankfurt, Germany.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!