Example 3

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

O(Program) = O(i-loop) + O(j-loop) = O(N) + O(N) = O(N)

Example 4

scanf("%d",&n);
for(i=1;i<=n;i++)
for(j=i;j<=n;j++) printf("(%d,%d)\n",i,j);

O(Program) = O(i-loop)

O(i-loop) = SUM(i,1,N) of O(j-loop)
          = SUM(i,1,N) of (N-i)
          = N*(N-1)/2
          = O(N*N)