Answer:
29
Explanation:
for n=28:
--------------
Algorithm 1 performs f(n) = n2 + n/2 = 28*28 + 28/2 = 798
Algorithm 2 performs f(n) = 12*28 + 500 = 836
for n=29
--------------
Algorithm 1 performs f(n) = n2 + n/2 = 29*29 + 29/2 = 855.5
Algorithm 2 performs f(n) = 12*29 + 500 = 848
so, for n=29, algorithm 2 will be faster than algorithm 1
Answer:
struct item
{
float previousCost;
float taxAmount;
float updatedCost;
} itemObject;
void calculation(int cost,int quantity,float tax)
{
struct item *itemPointer=&itemObject;
itemPointer->previousCost=(cost) * (quantity);
itemPointer->taxAmount=itemPointer->previousCost * (tax/100);
itemPointer->updatedCost=itemPointer->previousCost+itemPointer->taxAmount;
}
Explanation:
- Define a structure called item that has 3 properties namely previousCost, taxAmount and updatedCost.
- The calculation function takes in 3 parameters and inside the calculation function, make a pointer object of the item structure.
- Calculate the previous cost by multiplying cost with quantity.
- Calculate the tax amount by multiplying previous cost with (tax / 100).
- Calculate the previous cost by adding previous cost with tax amount.
Business intelligence can be used by managers in order to see how well their departments are. Now go and get that A+
A function that returns Pascal's Triangle with n rows:
//import necessary headers
public class Pascal_Triangle {
// calculate factorial
static int factorial(int n)
{
int fact = 1;
int i;
for(i=1; i<n; i++)
{
fact*=i;
}
return i;
}
// Actual code to display the //pascal triangle
static void display(int n)
{
int i;
int line;
for(line=1;line<=n;line++)
{
for(i=0;i<=line;i++)
{
System.out.print((factorial(line)/factorial(line-i) * factorial(i)) + " ");
}
System.out.println();
}
}
// To read user input
public static void main(String[] args){
BufferedReader breader=new BufferedReader(new InputStreamReader(System.in));
int n;
System.out.println("Enter the size for creating Pascal triangle");
try {
n = Integer.parseInt(breader.readLine());
}
catch(Exception e){
System.out.println("Please enter a valid Input");
return;
}
System.out.println("The Pascal's Triangle is");
display(n);
}
}
<h3>
Answer:</h3>
<h3>
Explanation:</h3>
To remember this, remember that the F in Ctrl+F stands for “Find”.
Ctrl+H is a similar function called Find and Replace, which allows you to search for a value then replace all instances of it with a new value.
Ctrl+R fills from the selected cell(s) and to the right.
Ctrl+E activates the Flash Fil feature, which recognizes a pattern and fills in remaining cells automatically.