Respuesta :
Answer:
#include <iostream>
#include<conio.h>
using namespace std;
void main()
{
float freqk, freqsk1, freqsk2, freqsk3;
cout<<"Enter the Frequency of a Key = "
cin>>freqk;
freqsk1 = freqk * (1) * (1/6);
freqsk2 = freqk * (2) * (1/6);
freqsk3 = freqk * (3) * (1/6);
cout<<"\nFrequency of Key = "<<freqk<<endl;
cout<<"\nFrequency of Subsequent Key 1 = "<<freqsk1<<endl;
cout<<"\nFrequency of Subsequent Key 2 = "<<freqsk2<<endl;
cout<<"\nFrequency of Subsequent Key 3 = "<<freqsk3<<endl;
getch();
}
Explanation:
There are four variables required to store the frequency value of a key and its subsequent keys. All variable are in float values so that answer should calculated in decimal format. With the help of formula calculate the frequency of all subsequent keys with the help of given frequency of key.
Answer:
This program is executed in C++ using dev C++, The explanation of the code is given below. However, the expected result of this program after running is attached
Explanation:
#include <iostream>
#include <cmath>
#include<bits/stdc++.h>
using namespace std;
int main ()
{
double key=5;//it will generate next three keys from A;
double freq=440;//frequency ;
cout<<freq<<" ";//output the frequency
for(double i=2;i<key;i++)//loop to show next three frequency
{
float value = (1.0/12);// store value of (1/12)
double r=pow(2.0,value);//store value of r=2^(1/12);
double n=i;//number of ith iteration (number of next key)
double power=pow(r,n);//calculating r^n;
double result= freq* power;//function i.e. fn=f0*rn
cout<<result<<" ";//displaying result
}
}
