Q:

Write a program in C to check whether a number is a Pronic Number or Heteromecic Number or not

0

Write a program in C to check whether a number is a Pronic Number or Heteromecic Number or not


Expected Output :
Input a number: 132
The given number is a Pronic Number.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

# include <stdio.h>
# include <stdlib.h>



int main()
{
    int prno,i,n,flg;
	printf("\n\n Check whether a number is a Pronic Number or Heteromecic Number or not: \n");
	printf(" ----------------------------------------------------------------------------\n");
	printf(" Input a number: ");
	scanf("%d",&prno);
    for(i=1;i<=prno;i++)
        {
            if(i*(i+1)==prno) 
            {
            flg=1;
            break;
            }
        }
  
            if(flg==1)
            {
			printf(" The given number is a Pronic Number.\n");
            }
            else
            {
			printf(" The given number is not a Pronic Number.\n");
            }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now