Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- int coprime(int a, int h)
- {
- int temp;
- while(1){
- temp = a%h;
- if(temp==0)
- return h;
- a = h;
- h = temp;
- }
- }
- int main()
- {
- int c=1,i,t[50],nbt,k,j,test,taill;
- scanf("%d",&nbt);
- for(i=0;i<=nbt;i++){
- scanf("%d",&taill);
- for(j=0;j<taill;j++){
- scanf("%d",&t[j]);
- }
- for(k=0;k<taill;k++){
- test=coprime(t[k],t[k+1]);
- if(test==1&&(t[k]<t[k+1])){
- c++;
- }
- }
- printf("sequence of co primes : %d \n",c);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement