Answer:
The correct program to this question can be given as:
Program:
//header file
#include<iostream> //include header file
using namespace std;
//main
int main() //defining method main
{
double radius,area=0; //defining variables
double PI=3.14; //defining variable PI and assign value
cout <<"Enter the radius: "; //message
cin >> radius; //input value by user
area = PI * radius * radius; //formula to calculate area
cout << "Area: "<< area << endl; //print area
return 0;
}
Output:
Enter the radius: 3.0
Area: 28.26
Explanation:
In the above program code, a header file is included. In the next line, the main method is defined, which contain three double type variable that is "radius, area, and PI".
- The radius variable is used to take input by the user, and the area variable is to calculate the area of the circle, and the PI is used to hold a constant value, which is "3.14".
- After taking user input in radius variable the area variable has used the formula of the circle, which calculates a value and in the last print, the function uses "cout", that prints area variable value.
Answer:
Following are the code to this question can be described as follows:
c= input('Input triangle_char: ') #defining variable c that input character value
length = int(input('Enter triangle_height: ')) # Enter total height of triangle
for i in range(length): # loop for column values
for j in range(i+1): #loop to print row values
print(c,end=' ') #print value
print()# for new line
Output:
please find the attachment.
Explanation:
In the above python code, two variable "c and length" variables are declared, in variable c is used to input char variable value, in the next line, length variable is defined, that accepts total height from the user.
- In the next line, two for loop is declared, it uses as nested looping, in which the outer loop prints column values and inner the loop is used to prints rows.
- To prints all the value the print method is used, which prints the user input character triangle.
Answer:
The code will give an error that is "At least one public class is required in main file".
Explanation:
In the given code if we do not use the public access modifier to the class. It will give an error so, the correct code to this question as follows:
Program:
import java.util.HashSet; //import package
public class A //define class as public.
{
public static void main(String[ ] args) //define main method.
{
HashSet set = new HashSet(); //creating hashset object.
set.add("A"); //add alphabet in hashset
set.add("B"); //add alphabet in hashset
set.add("C"); //add alphabet in hashset
System.out.print("Size of HashSet is :"set.size()); //print the size of hashset.
}
}
Output:
Size of HashSet is : 3
Explanation of the program:
- In the above program, we define a public class that is "A" and inside the class, we define the main method.
- Inside the main method, we create a HashSet class object that is "set".
- To add elements in HashSet we use add() function that adds elements and in the last, we use the size() function that prints the size HashSet.
I think it’s B.. I’m pretty sure
The Motherboard contains instructions for the OS for hardware devices, such as the keyboard, mouse, and video card, and are stored in the systemroot\Windows\System32\Drivers folder.
Learned this in middle school, your welcome ;)