How do you write algorithm in c-program?

Here is a simple program that will tell you how to make an algorithm:

int main();


int length;

int width;

int total;

printf("What is the width: ");

scanf("%d", &width);

printf("What is the length: ");

scanf("%d", &length);

total = width * 2 + 2 * length; /*Here is the algorithm for finding the perimeter of a square*/

printf("The perimeter is: %d", total);

return 0;



What is the width: 32

What is the length: 55

The perimeter is: 174