0% found this document useful (0 votes)
5 views3 pages

Programs

The document contains multiple Java classes demonstrating different programming concepts. It includes examples of checking for Armstrong numbers, generating Fibonacci sequences, printing characters, and identifying palindromes. Each class has a main method that executes specific logic related to the topic it addresses.
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)
5 views3 pages

Programs

The document contains multiple Java classes demonstrating different programming concepts. It includes examples of checking for Armstrong numbers, generating Fibonacci sequences, printing characters, and identifying palindromes. Each class has a main method that executes specific logic related to the topic it addresses.
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

public class Sample {

public static void main(String[] args) {


int num=1638,count=0,temp1=0,temp2=0;
double sum=0;
temp1=num;
while(temp1>0)
{
temp1=temp1/10;
count++;
}
[Link]("count Value"+count);
temp2=num;
double digit=0.0;
while(temp2>0) {
digit= temp2%10;
sum= (sum+[Link](digit, count));
temp2=temp2/10;
}

if(sum==num)
[Link]("Armstrog number");
else
[Link]("not");

public class Sample {

public static void main(String[] args) {


int n1=0,n2=1,n3=0;
[Link](n1+" "+n2+" ");
for(int i=1;i<=10;i++)
{
n3=n1+n2;
[Link](" "+n3);
n1=n2;
n2=n3;
}

public class Trick2 {


public static void main(String[] args) {
for (int i = 0; i < 3; [Link]("X "), i++);
}
}
for (int i = 1, j = 5; i <= 5 && j >= 1; i++, j--) {
[Link]("i = " + i + ", j = " + j);
}

for (char c = 'A'; c <= 'Z'; c++) {


[Link](c + " ");
}

for (int i = 1, j = 10; i <= 5; i++, j--) {


[Link](i + " + " + j + " = " + (i + j));
}

public class Sample {

public static void main(String[] args) {


int num=153,digit=0,temp1=0,temp2=0,count=0;
double sum=0.0f;
temp1=num;
while(temp1>0)
{
temp1=temp1/10;
count++;
}
[Link]("Count is:"+count);
temp2=num;
while(temp2>0)
{
digit=temp2%10;
sum=(sum+[Link](digit, count));
temp2=temp2/10;
}
if(sum==num)
[Link]("Armstrong");
else
[Link]("Not Armstrong");
}

public class Sample {

public static void main(String[] args) {


int num=15551,digit=0,temp1=0,temp2=0,count=0,rev=0;
double sum=0.0f;
temp2=num;
while(temp2>0)
{
digit=temp2%10;
//sum=(sum+[Link](digit, count));
rev=rev*10 + digit;
temp2=temp2/10;
}
[Link]("reverse:"+rev);
if(rev==num)
[Link]("Palindrome");
else
[Link]("Not Palindrome");
}

You might also like