Posts

Showing posts with the label Java

IP- Program to find a given number is Perfect Number or not?

Image
Objective: To find the given number is Perfect Number or not? Program should accept a number through Net beans GUI, and on click of a button should find out a given number in a text field TFNum is Perfect Number or not. What are Perfect Numbers? Perfect Numbers are those numbers who's sum of individual factors is same as the number itself, with an  exception the number itself should not be included as one of the factors. Net beans using Java Solution  along with a screen shot: (Keeping in mind the students of class XI/XII having Informatics Practices as one of their subject) Screen shot: When you enter 9, for example which is not a perfect number: when you enter 6, which is a perfect number: private void BtnFindActionPerformed(java.awt.event.ActionEvent evt) {                                              int n=Integer.parseInt(TFNum.getText());         int sum=0; for(int i = 1; i < n; i++)         {         if(n % i == 0)         {        

IP - Program to generate Fibonacci Series

Image
Write a program to generate a Fibonacci series up to a given number using Net beans (Java)? Introduction to Fibonacci Series  Lets try to understand  What is Fibonacci Series?   It is a series of numbers that follows some pattern generated by adding previous two numbers, where first two numbers are 0 and 1.  Fibonacci series has quite a lot contribution to our life. Browse the internet and you will be able to find lot many, just by googling it. I have also summarized these useful links a single page -  Click here  to get more information about Fibonacci series.  Fibonacci Series using Java (Net beans)  private void Fibogen ActionPerformed (java.awt.event.ActionEvent evt) {                                              int N=Integer.parseInt(TF_UL.getText());         int a=0,b=1,c=a+b;         TA_FS.append(a+", " + b + ", ");         while(c<=N)         {             TA_FS.append(c+", ");             a=b;