-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloop.cpp
More file actions
36 lines (32 loc) · 741 Bytes
/
loop.cpp
File metadata and controls
36 lines (32 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <ctime>// include this header
//#include <time>
using namespace std;
long long i,j,sum=0;
//int start_s=clock();
int main() {
clock_t sTime;
sTime = clock();
for(i=1000000;i>2;i--)
{
//printf("%d \n",i);
// cout<<"\n i= "<<i;
// for(j=2;j<i;j++)
// {
// printf("%d \n",j);
// cout<< " \n j="<<j;
// if((int)i%(int)j==0)
// break;
// }
//if(i==j)
// sum=sum+i;
cout<<"\n"<<i;
}
//int stop_s=clock();
//cout << "time: " << (stop_s-start_s)/double(CLOCKS_PER_SEC)*1000 << endl;
clock_t cWait = clock();
cout << "Total CPU time used: " << (double) (clock()-sTime)/CLOCKS_PER_SEC << " seconds" << endl;
// cout<<"\n"<<sum;
return 0;
}
//