i want to know the time complexity for the following two algorithms void main (){-----------------------------------------T(n) for(int a=1 ; a<=20 ; a++) {------------? if(a%2==0) -------------? cout<<"value is Even"; --------? else cout<<'valuevis Odd";--------? } }
void main (){-----------------------------------------T(n)
int x=1; {------------?
int a=1; -------------?
while(a<=n){--------?
x=x*a; -------------?
a=a+2; -------------?
}
cout<<x;
}
Aucun commentaire:
Enregistrer un commentaire