Answer:
The method in python is as follows:
class myClass:
def printRange(min,max):
for i in range(min, max+1):
print("{"+str(i)+"} ", end = '')
Explanation:
This line declares the class
class myClass:
This line defines the method
def printRange(min,max):
This line iterates from min to max
for i in range(min, max+1):
This line prints the output in its required format
print("{"+str(i)+"} ", end = '')
Answer:
Thank you, they post on EVERY. SINGLE. QUESTION.
Explanation:
They keep posting the same file every time, but they might change the file after seeing this post. Please just don't click any files!
Answer:
// here is code in c++ to find the approx value of "e".
#include <bits/stdc++.h>
using namespace std;
// function to find factorial of a number
double fact(int n){
double f =1.0;
// if n=0 then return 1
if(n==0)
return 1;
for(int a=1;a<=n;++a)
f = f *a;
// return the factorial of number
return f;
}
// driver function
int main()
{
// variable
int n;
double sum=0;
cout<<"enter n:";
// read the value of n
cin>>n;
// Calculate the sum of the series
for (int x = 0; x <= n; x++)
{
sum += 1.0/fact(x);
}
// print the approx value of "e"
cout<<"Approx Value of e is: "<<sum<<endl;
return 0;
}
Explanation:
Read the value of "n" from user. Declare and initialize variable "sum" to store the sum of series.Create a function to Calculate the factorial of a given number. Calculate the sum of all the term of the series 1+1/1!+1/2!.....+1/n!.This will be the approx value of "e".
Output:
enter n:12
Approx Value of e is: 2.71828
Answer:-
(10111.001)₂
Explanation:
To convert a decimal number to a binary number we have to constantly divide the decimal number by 2 till the decimal number becomes zero and the binary number is writing the remainders in reverse order of obtaining them on each division.
Hence the binary number is 10111.001
To convert binary to hexa decimal we to make a group 4 binary bits starting from the decimal and moving outwards if the last group is not of 4 then add respective 0's and write the corresponding hexa decimal number.
<u>0001</u> <u>0111</u> . <u>0010</u>
1 7 2
Hence the hexadecimal number is 17.2