How to calculate time complexiy of the following line of code using 'Big-O' or 'Big-OH' notation???

1. scanf("%d",&n);
2. for(i=1,m=n+66;i<=m;i++)
3.      printf("%d \n",i);
4. for(j=n/21,m=n/5;j<=m;j++)
5.      printf("%d \n",j);

I have basic idea but i am getting confused...So, please help me to calculate time complexity of each step,
plus overall complexity.

i have gone through some books and sites but, the explanation is very complex......:(
And according to me the time comlexity of each step is,
1. 1
2. 1+1+(m+1)+(m) // may be true or not
3. 1
4. O(log n) // i know this is wrong
5. 1

PLEASE, correct my answer...

wouldnt the first one be O(n) or more precise O(n + 66) ?
second dont know it's just math something line n * 16 can exyst

i have gone through some books and sites but, the explanation is very complex......:(

Try this one.

thaks.....
So total complexityis

 O(1)//can be ignored
 O(n+66)
 O(1)
 O(log n)                  OR    log(n/5)..........???

And is it correct????

please exlayn how you calculated 4rd line ? from n/21 till n/5 why not other i mean if n is 21 then 21/21 is from 1 till 4.2 like O(n/5) dont know
i am interested in a result too

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.