Answer:
C++.
Explanation:
#include <iostream>
using namespace std;
/////////////////////////////////////////////////////////
void printPrime(int n) {
if (n > 0) {
cout<<"[2";
for (int i=3; i<=n; i++) {
bool isPrime = true;
for (int j=2; j<i; j++) {
if (i % j == 0) {
isPrime = false;
break;
}
}
if (isPrime == true)
cout<<", "<<i;
}
}
else {
cout<<"Invalid input";
}
cout<<"]";
}
/////////////////////////////////////////////////////////
int main() {
int n;
cout<<"Enter positive integer: ";
cin>>n;
printPrime(n);
return 0;
}
Answer:
T
Explanation:
just finished the assignment on edge
Answer:
public boolean equals(Object other)
{
// check correct instance
if (other instanceof IntTree)
{
try
{
IntTree otherTree = (IntTree) other;
return equals(overallRoot, otherTree.overallRoot);
}
// caught exceptions
catch (Exception e)
{
return false;
}
}
return false;
}
public boolean equals(IntTreeNode tree1, IntTreeNode tree2)
{
// if reach ends
if (tree1 == null && tree2 == null)
{
// they are equal
return true;
}
else if (tree1 == null || tree2 == null)
{
// not equal
return false;
}
// check left part
boolean leftPart = equals(tree1.left, tree2.left);
// check current element is same
boolean currentPart = tree1.element.equals(tree2.element);
// check right part
boolean rightPart = equals(tree1.right, tree2.right);
// all are equal
return (leftPart && currentPart && rightPart);
}
Explanation:
Answer: True
Explanation:
There are actually four ways to create a macro. You would want to use %let.