Answer:
There are various answers that are all correct.
Explanation:
An efficient code will take less time to compile and execute. It is less noticeable in small programs but in larger ones it becomes apparent. You would rather press start and have your program give you your values immediately rather than wait 20 seconds every time.
An efficient code will be easier for you to find mistakes in if there are errors when compiling, being smaller and easier to read.
It will be easier to make small changes to an efficient program that for example, used global variables instead of local ones (where applicable).
If the code will be used/viewed by other people in the future, an efficient code will help them to use the program with ease rather than trying to understand a potentially messier code.
These are just some reasons that came to me off the top of my head, there could be more potential answers
Answer:
// here is code in C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables
int x=5,y=2,z=9;
int min;
// find the smallest value and assign to min
// if x is smallest
if(x < y && x < z)
// assign x to min
min=x;
// if y is smallest
else if(y < z)
// assign y to min
min=y;
// if z is smallest
else
// assign z to min
min=z;
// print the smallest
cout<<"smallest value is:"<<min<<endl;
return 0;
}
Explanation:
Declare and initialize variables x=5,y=2 and z=9.Then check if x is less than y and x is less than z, assign value of x to variable "min" .Else if value of y is less than value of z then smallest value is y, assign value of y to "min".Else z will be the smallest value, assign its value to "min".
Output:
smallest value is:2
Answer:
maybe you can use Grammarly
Explanation: