Computer Scientists are Pretty Pessimistic

Friday 23 October 2015

UVA 11461 (Square Numbers)

Solution : :

#include <stdio.h>
#include <math.h>
int main ()
{
    int a,b,i,sq,count;
    while(scanf("%d %d",&a,&b))
    {
        count=0;
         if(a==0&&b==0)
        {
            break;
        }
        for(i=a;i<=b;i++)
        {
            sq=sqrt(i);
            if(i==sq*sq)
            {
                count++;
            }
        }
       printf("%d\n",count);
    }
    return 0;
}

2 comments:

  1. I will discourage you to put direct solution in your blog post rather try to explain which problem you think may help other to learn new thing with elaborate editorial type post. Good Luck :)

    ReplyDelete