0% found this document useful (0 votes)
4 views2 pages

Java Programs: Armstrong, Fibonacci, Table

The document contains three Java programs: one to check if a number is an Armstrong number, another to generate the Fibonacci series up to a specified number, and a third to input a number and print its multiplication table up to 10. Each program is structured within a 'Main' class and demonstrates basic control flow and arithmetic operations. The Armstrong number program specifically checks if 153 is an Armstrong number, while the Fibonacci program prints the first 25 numbers in the series.

Uploaded by

tushikasahu5
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Java Programs: Armstrong, Fibonacci, Table

The document contains three Java programs: one to check if a number is an Armstrong number, another to generate the Fibonacci series up to a specified number, and a third to input a number and print its multiplication table up to 10. Each program is structured within a 'Main' class and demonstrates basic control flow and arithmetic operations. The Armstrong number program specifically checks if 153 is an Armstrong number, while the Fibonacci program prints the first 25 numbers in the series.

Uploaded by

tushikasahu5
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Write a program for arm strong number

class Main
{
public static void main(String args[])
{
int n=153;
int p=n;
int r;
int sum=0;
while(n>0)
{
r=n%10;
sum=sum+r*r*r;
n=n/10;
}
if (p==sum)
[Link]("153 is armstrong number");
else
[Link]("153 is not armstrong number");
}
}

write a program for fibbonacci series


class Main
{
public static void main(String args[])
{
int a=0;
int b=1;
int n=25;
int i, c;
[Link](a+" "+b);
for(i=1; i<=n-2; i++)
{
c=a+b;
[Link](c);
a=b;
b=c;
}
}
}

Writte a program to input a number and print a table of the given number upto to

import [Link];

public class Main


{
public static void main(String args[])
{
Scanner obj = new Scanner([Link]);
[Link]("Enter a number:");
int number = [Link]();
for(int i=1; i<=10; i++)
{
[Link](number*i);
}
[Link]();
}
}

You might also like