Answer:
<u>In physics</u>, efficiency is a measure of how much energy is conserved in a process.
<u>In programming</u>, efficiency is directly linked with the speed of runtime execution for software and algorithmic efficiency.
In this comparison, both meanings try to measure the quality of the processes and have formulas to detect this efficiency.
Both meanings have different formulas to define the measures, Big O notation for programming and percentage of energy output divided by energy input for physics. Furthermore, in physics is not possible to get 100% efficiency, but it is possible for programming to have O(1) of efficiency.
Answer:
#include<bits/stdc++.h>
using namespace std;
int sumOfinteger(int );
// Returns sum of all digits in numbers from 1 to n
int sumOfintegersFrom1ToN(int n) {
int result = 0; // initialize result
// One by one compute sum of digits in every number from
// 1 to n
for (int x = 1; x <= n; x++)
result += sumOfinteger(x);
return result;
}
// A utility function to compute sum of digits in a
// given number x
int sumOfinteger(int x) {
int sum = 0;
while (x != 0) {
sum += x %10;
x = x /10; }
return sum; }
// Driver Program
int main() {
int n ;
cout<<"enter a number between 1 and n : ";
cin>>n;
cout << "Sum of digits in numbers from 1 to " << n << " is " << sumOfDigitsFrom1ToN(n);
return 0; }
Your records and paperwork. That will be your answer