প্রবলেমটি পড়ুন এবং বুঝুন
#include<iostream>
#include<cmath>
using namespace std;
void square(int a,int b)
{
int counter=0;
for(int i=a;i<=b;i++)
{
double p=sqrt(i);
int a=(int) p;
if(i==0)
continue;
else if(p-a==0)
counter++;
}
cout<<counter<<endl;
}
int main()
{
int a,b;
while((cin>>a>>b) && (a!=0 || b!=0))
square(a,b);
return 0;
}
#include<iostream>
#include<cmath>
using namespace std;
void square(int a,int b)
{
int counter=0;
for(int i=a;i<=b;i++)
{
double p=sqrt(i);
int a=(int) p;
if(i==0)
continue;
else if(p-a==0)
counter++;
}
cout<<counter<<endl;
}
int main()
{
int a,b;
while((cin>>a>>b) && (a!=0 || b!=0))
square(a,b);
return 0;
}
No comments:
Post a Comment