You would go west. Japan is closer to Hawaii than any other state.
Answer:
#include<iostream>
#include<cmath>
using namespace std;
int main(){
float num;
float sum = 0.0;
for(int i=1;i<=5;i++){
cout<<"\nPlease enter the number: ";
cin>>num;
sum = sum + round(num);
}
float avg = sum/5;
cout<<"The sum is: "<<sum<<endl;
cout<<"The average is: "<<avg<<endl;
}
Explanation:
Create the main function and declare the variable 'num' and define the variable sum with zero.
Then, take a for loop and it runs for 5 times because of the condition i<=5.
print the message for the user on the screen, then the user enters the decimal value. After that, round the decimal number to the nearest integer.
we can use inbuilt function round(), which is defined in the cmath library and it takes the argument decimal.
For example:
round(5.89) it gives the integer 6.
Then, take the sum of all-rounded value and this process runs for 5 times. after that, take the average by dividing the sum by 5.
and then, print the sum and average value.
<h2>Only when the default parameter are defined in the function</h2>
Explanation:
Answer is same for both the question.
- A default argument or default parameter is assigned an automatic value when the function is invoked.
- So the default value will be assigned during the function definition itself.
- You can find the assignment operator which is being used in the function definition.
- You can overwrite the default values by passing your own value in the calling portion
- The constraint here is that, the default parameter should always be the last parameter of function definition to avoid ambiguity.
There are various connectivity technologies that we use to connect. They are Ethernet, Internet (Wireless Connection), Bluetooth, Wi-Fi and Cellular.
Explanation:
- Ethernet is the direct connection among the devices that are located close to each other in a building. This is used for small scale enterprises.
- Wi-Fi lets wireless connections among multiple devices without any physical connection. And it is most extensively used in most of the corporate companies.
- Bluetooth is used to transfer the data from one device to the other when they are near.
- Cellular is used to connect people across the globe. And it is used widely in every enterprises.
Basic understanding of code language such as Java, C++, Swift (iOS) etc. without knowledge of these, you’ll be lost trust me. Study up on these in your spare time. They do teach this stuff in college, but being ahead of the game is always good. No pun intended kek ;D