UVA 11461 - Square Numbers Solve
#include<stdio.h>
#include<math.h>
main()
{
int i,c=0,a,b;
int sum=0;
while(c<201){
scanf("%d %d",&a,&b);
if(a==0 && b==0) break;
for(i=a; i<=b; i++){
float sq = sqrt(i);
if(sq -(int)sq==0) {
sum=sum+1;}
}
printf("%d\n",sum);
sum=0;
}
}
Problem link : https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=26&page=show_problem&problem=2456
#include<stdio.h>
#include<math.h>
main()
{
int i,c=0,a,b;
int sum=0;
while(c<201){
scanf("%d %d",&a,&b);
if(a==0 && b==0) break;
for(i=a; i<=b; i++){
float sq = sqrt(i);
if(sq -(int)sq==0) {
sum=sum+1;}
}
printf("%d\n",sum);
sum=0;
}
}
Problem link : https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=26&page=show_problem&problem=2456
No comments:
Post a Comment
Thank you for commenting. Please wait for response :)