#include<stdio.h>
#include<stdlib.h>

void main()
{
    double count = 0;
    int input = 0;
    int sum = 0;
    float average=0;


    while ( count < 20)
    {
        printf("Please enter integer number : ");
        scanf_s("%d" , &input);
        sum = sum + input;
        count = count++;
    }

    average = sum / count;


    printf("The total sum is :%d\n" , sum);
    printf("The average of values entered is :%g\n", average);
    system("pause");


}

I think your question needs to be less vague.
And as always use CODE TAGS it tends to get you more help if people can read your code.

sorry, i am new user in daniweb....
i mean is how many times my program has been run.....can u help me please???

The only way to find out how many times you executed the program is to write a value to a file or the registry. Programs can not retain values from one instance to another.

The only way to find out how many times you executed the program is to write a value to a file or the registry. Programs can not retain values from one instance to another.

my question is this
my program should output the number of times each of the tasks has been invoked.

can u help me please????

use a counter for each task

use a counter for each task

how to use???

set a counter for every task(value of a counter starts at 0)
every time a task is invoked add 1 to its counter, then at the end of the program print all of the counters to know how many times the task had been invoked by its specific counter

set a counter for every task(value of a counter starts at 0)
every time a task is invoked add 1 to its counter, then at the end of the program print all of the counters to know how many times the task had been invoked by its specific counter

can u give me example of the counter code?????

I'm not so sure which of these are the tasks that runs you want to count so...

int counter1 = 0;//set the variable
.
.
.
while ( count < 20)
{
printf("Please enter integer number : ");
scanf_s("%d" , &input);
sum = sum + input;
count = count++;
counter1++; //counts how many times the while loop or any of its content ran 
}

I'm not so sure which of these are the tasks that runs you want to count so...

int counter1 = 0;//set the variable
.
.
.
while ( count < 20)
{
printf("Please enter integer number : ");
scanf_s("%d" , &input);
sum = sum + input;
count = count++;
counter1++; //counts how many times the while loop or any of its content ran 
}

thanks....

I'm not so sure which of these are the tasks that runs you want to count so...

int counter1 = 0;//set the variable
.
.
.
while ( count < 20)
{
printf("Please enter integer number : ");
scanf_s("%d" , &input);
sum = sum + input;
count = count++;
counter1++; //counts how many times the while loop or any of its content ran 
}

thanks.....

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.