Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <pthread.h>
- int fib(int n)
- {
- if ( n == 0 )
- {
- return 0;
- }
- if ( n == 1 )
- {
- return 1;
- }
- if ( n > 1)
- {
- return ( fib(n-1) + fib(n-2) );
- }
- }
- void *wyswietl()
- {
- int x,n;
- scanf("%i",&n);
- x = fib(n);
- printf("%i",x);
- printf("\n");
- }
- void *postep()
- {
- while (1>0)
- {
- usleep(1000000);
- printf(".");
- }
- }
- int main()
- {
- pthread_t thread1, thread2;
- int iret1, iret2;
- iret1 = pthread_create( &thread1, NULL, wyswietl, (void *) NULL);
- iret2 = pthread_create( &thread2, NULL, postep, (void *) NULL);
- pthread_join(thread1,NULL);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement