Professional Documents
Culture Documents
Btech
Btech
a013IcsEO6SO SfabaZ
SET- 10
1f(n== ll ne zo)
ietusrn T
else
int gcdC1nt a, t t b)
(a-o)
1etuxn bS
votd matn ()
9
1e #include<stdio.h>
11#include<time.h>
12 int fact(int n){
13 if(n -= 1 || n == e){
14 return 1
15
16 elset
17 return n*fact(n-1)
18
19
20
21
int gcd(int
if(a =-e
a, int b)
22 return b
23
24
25
return
gcd (b%a, a);
26 void main(){
I
27 int , n
28 clock_t start, last, total;
29 printf("Enter them valuel\n");
30 scanf("%d", &m);
31 printf("Enter the n value\n");
32 scanf("%d", &n);
33 start=clock();
34 int h-£netln
18
19
20 int gcd(int a, int b)
21 if(a -
22 return b
23
24 return scd(ba, )
25
26 void main(){
27 int m, n
28 clock tstart, lest, totalg
29 printf("Enter them value\n")
30 scanf("%d" 8)
31 printf("Enter the n valueln)3
32 scanf("%d". &n)
33 start=clock()
34 int mth fact (m)
35 int nth-fect (n)
36 printf("\n")3
37 printf( The mth and nth values are d, Xd\n,h th);
38 printfAnd the GCD of these mth %d and nth d values is ain", th, nth, gd(t
39 last clock()
40 total (last-start)I CLOCKS PER SEC;
41 printf(Time taken %ld". total);
42
43
input
Enter the m value