Answer:
In C++:
#include <iostream>
using namespace std;
int main(){
string fname,lname; int num;
cout<<"Firstname: "; cin>>fname;
cout<<"Lastname: "; cin>>lname;
cout<<"4 digits: "; cin>>num;
string login = lname;
if(lname.length()>=5){
login = lname.substr(0, 5); }
login+=fname.substr(0,1)+to_string(num%100);
cout<<login;
return 0;
}
Explanation:
See attachment for explanation where I used comments to explain each line
Answer:
The answer is "Option a"
Explanation:
The given question is incomplete, that's why its correct solution can be defined as follows:
The above-given question is the part of the Binary Autocomplete, in which this Autocomplete function would be a full word or sentence after just a few other letters were entered into the system. It approach improves text taking appropriate on smartphone devices of particular because every letter should not be written in such a single phrase.
Answer:
Pay attention to what you buy and limit yourself to an amount of money everyday.
Explanation:
This is just a simple way from spending a lot and limits your everyday spendings when you actually leave an amount for yourself.
Answer:
public class MagicSquare {
public static void main(String[] args) {
int[][] square = {
{ 8, 11, 14, 1},
{13, 2, 7,12},
{ 3, 16, 9, 6},
{10, 5, 4, 15}
};
System.out.printf("The square %s a magic square. %n",
(isMagicSquare(square) ? "is" : "is not"));
}
public static boolean isMagicSquare(int[][] square) {
if(square.length != square[0].length) {
return false;
}
int sum = 0;
for(int i = 0; i < square[0].length; ++i) {
sum += square[0][i];
}
int d1 = 0, d2 = 0;
for(int i = 0; i < square.length; ++i) {
int row_sum = 0;
int col_sum = 0;
for(int j = 0; j < square[0].length; ++j) {
if(i == j) {
d1 += square[i][j];
}
if(j == square.length-i-1) {
d2 += square[i][j];
}
row_sum += square[i][j];
col_sum += square[j][i];
}
if(row_sum != sum || col_sum != sum) {
return false;
}
}
return d1 == sum && d2 == sum;
}
}
The program below is able to calculate the area of a circle inscribed in a Square.
<h3>What is a program?</h3>
A program is a set of instructions given to the computer with specific end results in mind.
<u>Sample program in Java
</u>// Java Program to find the area of
// an inscribed circle in a square.
import java.io.*;
class GFG {
static double PI = 3.14;
// Function to find area of an
// inscribed circle in a square.
static double areaOfInscribedCircle(float a)
{
return ( PI / 4 ) * a * a;
}
// Driver code
public static void main (String[] args)
{
float a = 8;
System.out.println("Area of an inscribed"
+ " circle: " + areaOfInscribedCircle(a));
}
}
Learn more about programs at :
brainly.com/question/1538272
#SPJ1