First of all, we will need a function that checks if a number is prime or not:
boolean isPrime(int n){
for(int i=2; i<=math.sqrt(n); i++){
if(n % i == 0) return false;
}
return true;
}
Then, in the main program, we will call this function with all the desired inputs, and we will print the prime numbers:
for(int n=100; n<= 1000; n++){
if(isPrime(n)) print(n);
}
Answer:
hp/omen or SONY
Explanation:
because hp has been making a lot better computers, and possibly SONY because the ps5 release that came out a couple years ago.
Answer:
// here is code in C++.
#include <bits/stdc++.h>
using namespace std;
// function
string is_perfect(int n)
{
// string variables
string str;
// if number is negative
if (n < 0)
{
str="invalid input.";
}
// if number is positive
else
{
int a=sqrt(n);
// if number is perfect square
if((a*a)==n)
{
str="True";
}
// if number is not perfect square
else
{
str="False";
}
}
// return the string
return str;
}
// main function
int main()
{
// variables
int n;
cout<<"enter the number:";
// read the value of n
cin>>n;
// call the function
string value=is_perfect(n);
// print the result
cout<<value<<endl;
return 0;
}
Explanation:
Read a number from user and assign it to variable "n".Then call the function is_perfect() with parameter n.First check whether number is negative or not. If number is negative then return a string "invalid input".If number is positive and perfect square then return a string "True" else return a string "False".
Output:
enter the number:-3
invalid input.
enter the number:5
False
enter the number:16
True
Answer:
a:(allows the different parts of a computer to communicate)
Explanation:
The motherboard is the main command center for the whole pc which recieves your inputs and responds by sending outputs...