Program P2.c -- tcov Output
#include <stdio.h>
#include <math.h>
int root( int n ) {
2745696 -> return sqrt(n);
}
int prime( int n ) {
int i;
99999 -> for( i = 2; i < root(n); i++ )
2736017 -> if (n % i == 0)
90320 -> return 0;
2645697 -> return 1;
}
int main() {
int i, n;
1 -> n = 100000;
for( i = 2; i <= n; i++ )
99999 -> if (prime(i))
9679 -> printf("%d\n", i);
99999 -> return 0;
}
Top 10 Blocks
Line Count
5 2745696
11 2736017
13 2645697
10 99999
20 99999
22 99999
12 90320
21 9679
18 1
9 Basic blocks in this file
9 Basic blocks executed
100.00 Percent of the file executed
8527407 Total basic block executions
947489.69 Average executions per basic block