Answer:
Enter a number: 7
Enter a number: 10
Traceback (most recent call last):
File "main.py", line 3, in <module>
print (numi + num2)
NameError: name 'numi' is not defined
Explanation:
The typo in the print statement causes a run-time error, where obviously num1+num2 was expected, and an output of 17.
Answer:
The while loop is used and the factors of the integer are computed by using the modulus operator and checking if the remainder of the number divided by i is 0. 3. Then the factors of the integer are then again checked if the factor is prime or not.
Explanation:
google
Answer:
the indexOf() method
Explanation:
The indexOf() method in java returns the first occurrence of the of the string or a character specified in it.It can be used to search both a character or a string.
for example:-
import java.util.*;
import java.lang.*;
import java.io.*;
class indexOf
{
public static void main (String[] args)
{
String s="IamNumber4";
int l=s.indexOf("Num");//using indexOf() method on string object..
System.out.println(l);
}
}
Output:-
3
there are many differences, but the most prominent are that they have different apis (aplication programing interface) and different architecture
also mobile apps tend to use less system resources and are more regulated by services like the google play store, opposed to the fairly unregulated uwp platform used by most windows machines.
Answer:
See explaination
Explanation:
#include <iostream>
using namespace std;
string * createAPoemDynamically()
{
string *p = new string;
*p = "Roses are red, violets are blue";
return p;
}
int main() {
while(true) {
string *p;
p = createAPoemDynamically();
if (!p)
{
cout << "Memory allocation failed\n";
}
cout<<*p<<"\n";
// assume that the poem p is not needed at this point
//delete allocated memory
delete p;
}
}