Answer:
Written in Python
for num in range(1,1001):
sum=0
for j in range(1,num+1):
if num%j==0:
sum = sum + j
if num == sum:
print(str(num)+" is a perfect number")
Explanation:
This line gets the range from 1 to 1000
for num in range(1,1001):
This line initializes sum to 0 for each number 1 to 1000
sum=0
This line gets the divisor for each number 1 to 1000
for j in range(1,num+1):
This following if condition line checks for divisor of each number
<em> if num%j==0:
</em>
<em> sum = sum + j
</em>
The following if condition checks for perfect number
if num == sum:
print(str(num)+" is a perfect number")
Answer:
Here is the program for the given question
Explanation:
class StringSet
{
ArrayList<String> arraylist; //a reference variable of ArrayList of generic type String
//A no argument constructor.
public StringSet()
{
arraylist=new ArrayList<String>(); //instantiating the ArrayList object
}
//A mutator that adds a String newStr to the StringSet object.
void add(String newStr)
{
arraylist.add(newStr); // add(String) method to add string to the arraylist
}
//An accessor that returns the number of String objects that have been added to this StringSet object.
int size()
{
return arraylist.size(); // size() method which gives the number of elements in the list
}
//An accessor that returns the total number of characters in all of the Strings that have been added to this StringSet object.
int numChars()
{
int sum = 0;
for(String str:arraylist) //for-each loop; can be read as for each string in arraylist
{
sum+=str.length();
}
return sum;
}
//An accessor that returns the number of Strings in the StringSet object that have exactly len characters.
int countStrings(int len)
{
int count = 0;
for(String str:arraylist)
{
if(str.length() == len)
count++;
}
return count;
}
}
Answer:
The function in python is as follows
def is_present(num,list):
stat = False
if num in list:
stat = True
return bool(stat)
Explanation:
This defines the function
def is_present(num,list):
This initializes a boolean variable to false
stat = False
If the integer number is present in the list
if num in list:
This boolean variable is updated to true
stat = True
This returns true or false
return bool(stat)
Answer:
(a)Applications Time Stamp Events
(b)S=0.5(W-
)+
, where
≤W≤
+8.
Explanation:
Some applications assume that clocks always advance, so they could timestamp events under this assumption.
In our case we have the wrong timed clock, say W and the hardware clock H which is supposed to advance at a perfect rate.
We proceed to construct a software clock such that after 8 seconds we can replace the wrong timed clock with the software clock in good conditions.
Let us denote the software clock with S.
Then, S=c(W-
)+
where:
=The current Time(10:27:54) and;
c is to be found.
We already know that S=
+4 when W=
+8,
So:
S=c(W-
)+
+4=c(
+8-
)+
4=8c
c=0.5
We obtain the formula
S=0.5(W-
)+
, where
≤W≤
+8.
The permission to give the executive group the right to read, change, and assign permissions to document is Give executive Change to shared permissions
<h3>What do you mean of executive?</h3>
An executive is seen as a kind of a powerful person and they are the people that are known to be responsible for making things go on or run smoothly in any organization.
Therefore, The permission to give the executive group the right to read, change, and assign permissions to document is Give executive Change to shared permissions
Learn more about executive from
brainly.com/question/838027
#SPJ1