An algorithm refers to the logical list of methods or stages utilized to solve a particular problem.
Typically, the process is done by a computer.
The algorithm should contain the following characteristics:
The algorithm should be easy to understand.
There should be no ambiguity.
It should have a one-of-a-kind answer to the problem.
The solution should be reached in a finite number of steps.
An algorithm to find the highest revenue each day is as follows-
#include<stdio.h>
int main(){
int n, m;
printf("Enter the number of days and products:" );
scanf("%d %d", &m, &n);
int arr[m][n];
for(int j=0;j<m;j++){
printf("Enter day %d 's sales:\n" ,(j+1));
for(int i=0;i<n;i++){
printf("Revenue by product %d:" , (i+1));
scanf("%d" , &arr[j][i]); } }
for(int j=0;j<m;j++){
for(int i=0; i<n;i++){
if (arr[j][0] < arr[j][i]) { arr[j][0] = arr[j][i]; } }
printf("The highest revenue on day %d = %d", (j+1), arr[j][0]); }