In this Article, you will learn how to check whether the number is pronic number or heteromecic number or not. A Pronic Number is a number which is the product of two consecutive number ,i.e., a number of the form n*(n+1).It is also known as rectangular number,heteromecic number or oblong number).
- C Program to swap two number with using third variable
- C Program to find the factorial of the number
- C Program to check whether the number is Palindrome or not
- C Program to swap two number without using Third variable
- C Program to display Fibonacci in c using for loop
- C Program using Switch case to enter a digit (0-9) and write in word
- C program to print the factor of the number
C program to check whether the number is pronic number or heteromecic number or not| |
Pronic Number |Heteromecic Number | Rectangular Number:
A Pronic Number is a number which is the product of two consecutive number ,i.e., a number of the form n*(n+1).It is also known as rectangular number ,heteromecic number or oblong number .
Pronic number (n)= x*(x+1)
For Example: 6 is a pronic number
2*3=6
2*(2+1)=6
C program to check whether the number is pronic number or heteromecic number or not|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /* C program to check whether the number is pronic number or heteromecic number or not */ #include<stdio.h> #include <stdlib.h> int main(){ int i,n,p,flag=0; printf("Enter an Integer:"); scanf("%d",&p); for(i=1;i<=p;i++) { if(i*(i+1)==p) { flag=1; break; } } if(flag==1) { printf("\n The number is a pronic number:"); } else { printf("\n The number is not a pronic number:"); return 0; } } |
Output:
I hope you have read our Article " C Program to check whether the number is pronic number or heteromecic number or not" and you have collected lots of information from there. If you like the post, then please comment and share among your friends and family. you can write your opinion about my post in the comment box.
Thank you!
No comments:
Post a Comment
If you have any queries ,please let us know