// Simple Java program to find sum of series
// with cubes of first n natural numbers
import java.util.*;
import java.lang.*;
class GFG {
/* Returns the sum of series */
public static int sumOfSeries(int n)
{
int sum = 0;
for (int x = 1; x <= n; x++)
sum += x * x * x;
return sum;
}
// Driver Function
public static void main(String[] args)
{
int n = 5;
System.out.println(sumOfSeries(n));
}
}
// Code Contributed by Mohit Gupta_OMG <(0_o)>
The Computer Fraud and Abuse Act I believe. Sorry if I’m wrong and I hope that it helps :)
In Lanugange=Hi! translator is required because if you visit a different country and you don't know the language than a translator will help a lot
In computer=Hi! It translates a high level language program into machine language program the central processing unit (CPU) can understand.
Answer:
Answer given below
Explanation:
a) 10 coins ( 25*8 + 1*2)
b) 14 coins (27*10 + 12*1 + 7*1 + 3*1 + 1*1)
<u></u>
<u>Source Code in C++:
</u>
#include <iostream>
using namespace std;
//main function
int main()
{
int n,n1;
cout << "Enter the amount : "; //taking amount as input
cin >> n;
if(n<=0)
{
cout << "Fatal Error : Input Failure." << endl;
return 1;
}
cout << "Enter the number of denominations : "; //taking number of denominations as input
cin >> n1;
if(n1<=0)
{
cout << "Fatal Error : Input Failure." << endl;
return 1;
}
int a[n1],c[n1],sum=0; //array to keep count of each amount, and sum to store total coins
cout << "Enter the denominations in descending order : ";
for(int i=0;i<n1;i++)
{
cin >> a[i];
}
for(int i=0;i<n1;i++)
{
c[i]=n/a[i];
sum=sum+c[i];
n=n%a[i];
}
for(int i=0;i<5;i++)
{
cout << a[i] << " : " << c[i] << endl;
}
return 0;
}