Program to find out the Given Number is PRONIC OR NOT

/*PRONIC NUMBER IS A NUMBER WHICH A PRODUCT OF TWO CONSECUTIVE NUMBER*/
#include<stdio.h>
main()
{
int a;
int i=1,j,found=0;
printf("Enter any number");
scanf("%d",&a);
while((i*(i+1))<=a)
    {
       if((i*(i+1))==a)
          {
              printf("Given no. is pronic, consecutive no. are %d x %d ",i,(i+1));
              found=1;
              break;
           }
   
i++;
     }
        if(found==0)
           printf("Given no. is not a pronic no.");

}

Comments

Post a Comment