Answer:
The following program is in C++.
#include <bits/stdc++.h>
using namespace std;
void lastChars(string s)
{
int l=s.length();
if(l!=0)
{
cout<<"The last character of the string is: "<<s[l-1];
}
}
int main() {
string s;//declaring a string..
getline(cin,s);//taking input of the string..
lastChars(s);//calling the function..
return 0;
}
Input:-
Alex is going home
Output:-
The last character of the string is: e
Explanation:
In the function lastChars() there is one argument that is a string.I have declared a integer variable l that stores the length of the string.If the length of the string is not 0.Then printing the last character of the string.In the main function I have called the function lastChars() with the string s that is prompted from the user.
Answer:
Explanation:
Kindly go through the attachment for the step by step approach to the solution of this question.
I attached a photo that explains and gives the answer to your questions. Had to add a border because the whole picture didn’t fit.
Answer:
initial diameter of the sample is 2.95 mm
Explanation:
given data
yield load = 2100 N
maximum load = 3400 N
failure load = 2350 N
ultimate engineering stress = 497.4 MPa = 497 ×
N/m²
to find out
What was the initial diameter of the sample in mm
solution
we will apply here ultimate engineering stress formula that is express as
ultimate engineering stress =
...............1
here A is area and P max is maximum load applied
so area =
here d is initial diameter
so put all value in equation 1
497 ×
= 
solve it we get d
d = 2.95 ×
m
so initial diameter of the sample is 2.95 mm