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

  • برمجة سي c
  • برمجة

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.

الأجوبة

# 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");
            }
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...