cpp program Raj's teacher Anu uses chalk to write on the board. When the chalk reduces to 1/squareroot(n) of its original size, she keeps the chalk aside as it gets too small. She joins all the small pieces of the chalk and makes another chalk of the same size and uses it. If she uses one chalk each day, in how many days will she use the given n number of chalks?
Answers
Answered by
6
Answer:
#include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;
int main()
{
float n,root,count=0.00;
int val=1,days,ans;
cin>>n;
root=(1/sqrt(n));
cout<<setprecision(2);
for(int i=0;i<n;i++)
count=root+count;
days=int(count);
ans=n+days;
cout<<ans+1;
}
Explanation:
Answered by
1
Answer:
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int chalk;
cin>>chalk;
int rem = (1/sqrt(chalk))*chalk;
int day = chalk + rem + 1;
cout<<day;
}
Explanation:
Similar questions