Program Solution
Program Solution
Question 3:
import [Link].*;
class FashionCourier
{
String name;
int wt;
double charge;
FashionCourier()
{
name = "";
wt = 0;
charge = 0.0d;
}
void accept()
{
Scanner sc = new Scanner([Link]);
[Link]("Enter name");
name = [Link]();
[Link]("Enter weight ");
wt = [Link]();
}
void compute()
{
if(wt <= 5)
{
charge = wt * 50;
}
else if(wt > 5 && wt <= 10)
{
charge = (5 * 50) + (wt - 5) * 150;
}
else if(wt > 10 && wt <= 20)
{
charge = (5*50)+(5*150)+(wt-10)*200;
}
else if(wt > 20)
{
charge = (5*50)+(5*150)+(10*200)+(wt-20)*350;
}
charge = charge + (charge * 5.0/100.0);
}
Page 1 of 50
void diasplay()
{
[Link]("Name"+"\t"+"Weight"+"\t"+"Bill Amount");
[Link](name+"\t"+wt+"\t"+charge);
}
public static void main(String args[])
{
FashionCourier obj = new FashionCourier();
[Link]();
[Link]();
[Link]();
}
Question 5:
import [Link].*;
class Palindromspecial
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the string");
String s = [Link]();
String s2 = s;
String s1="";
Page 2 of 50
}
Question 6:
import [Link].*;
class Norm {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter the number");
int n = [Link]();
int pro = 1;
int sum = 0;
while(n > 0)
{
int digit = n % 10;
pro = digit * digit;
sum += pro;
n = n / 10;
}
int y = (int)[Link](sum);
[Link]("The Square root of "+ sum + " is "+y);
}
}
Question 7:
import [Link].*;
class SumOFColumn
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
int a[][] = new int[3][3];
[Link]("Enter 3*3 array values");
for(int i = 0; i<3; i++)
{
for(int j = 0; j<3; j++)
{
a[i][j] = [Link]();
}
}
[Link]("\nGiven array is : ");
for(int i = 0; i<3; i++)
Page 3 of 50
{
for(int j = 0; j<3; j++)
{
[Link](a[i][j]+" ");
}
[Link]();
}
for(int i = 0; i<3; i++)
{
int sum =0;
for(int j = 0; j<3; j++)
{
sum+=a[j][i];
}
[Link]("Sum of "+i+" column is "+sum);
}
}
}
Question 8:
class Overload
{
void result()
{
for(int i=65; i<=90; i=i+2)
{
[Link]((char)i+",");
}
}
Page 4 of 50
{
if(j%2!=0)
{
[Link]("@"+" ");
}
else
{
[Link]("$"+" ");
}
}
[Link]();
}
}
public static void main(String args[])
{
Overload obj = new Overload();
[Link]();
[Link](2,5);
[Link]('@','$');
}
}
-------------------------------------------------
2023 Specimen paper solution
Question 3:
import [Link].*;
class employee {
int eno, age;
String name;
double basic;
double hra=0,da=0,pf=0,net=0;
void accept()
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the eno");
eno = [Link]();
[Link]("Enter the age");
age = [Link]();
[Link]();
[Link](" Enter the name");
Page 5 of 50
name = [Link]();
[Link]("Enter the basic");
basic = [Link]();
}
void calculate()
{
hra = (basic * 18.5/100.0);
da = (basic * 17.45/100.0);
pf = (basic * 8.10/100.0);
net = basic+hra+da-pf;
if(age > 50)
{
net+=5000;
}
}
void print()
{
[Link]("eno " + eno);
[Link]("age "+age);
[Link]("name "+name);
[Link]("basic "+basic);
[Link]("net "+net);
}
public static void main(String[] args) {
employee obj = new employee();
[Link]();
[Link]();
[Link]();
}
}
Question 4:
class overload
{
void print()
{
int k = 1;
for(int i=1; i<=4; i++)
{
for(int j = 1; j<=i; j++)
{
[Link](k+" ");
Page 6 of 50
k++;
}
[Link]();
}
}
boolean print(int n)
{
int sum=0,cb=0;
int n1 = n;
while(n > 0)
{
int digit = n % 10;
sum += digit;
n = n /10;
}
cb = (int)[Link](sum,3);
if(cb == n1)
{
return true;
}
else
{
return false;
}
}
Page 7 of 50
boolean t = [Link](512);
[Link](t);
[Link](2,'s');
}
}
Question 5:
import [Link].*;
class BubbleSortInteger
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
int a[] = new int[5];
[Link]("Enter 5 integer values");
for(int i = 0; i<[Link]; i++)
{
a[i] = [Link]();
}
[Link]("Given values are");
for(int i = 0; i<[Link]; i++)
{
[Link](a[i]+" ");
}
int temp;
for(int i=0; i<[Link]; i++)
{
int flag = 0;
for(int j = 0; j<[Link]-1-i; j++)
{
if(a[j]<a[j+1])
{
temp =a[j];
a[j] = a[j+1];
a[j+1] = temp;
flag = 1;
}
}
if(flag == 0)
{
break;
}
}
[Link]("\nSorted array is");
Page 8 of 50
for(int i = 0; i<[Link]; i++)
{
[Link](a[i]+" ");
}
}
}
Question 6:
import [Link].*;
class Rangestest
{
public static void main(String args[])
{
double a[] = new double[5];
Scanner sc = new Scanner([Link]);
[Link]("Enter 5 values to array of double");
for(int i = 0; i<[Link]; i++)
{
a[i] = [Link]();
}
Page 9 of 50
}
}
Question 7:
import [Link].*;
class StringReverse
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the String");
String s = [Link]();
int vol=0;
String s1 = "";
Question 8:
import [Link].*;
class Students
{
public static void main(String args[])
{
String a[] = new String[5];
String search = "Ravi";
int found = 0;
Scanner sc = new Scanner([Link]);
[Link]("Enter the 5 students name");
for(int i = 0; i<[Link]; i++)
Page 10 of 50
{
a[i] = [Link]();
}
[Link]("Given values are : ");
for(int i = 0; i<[Link]; i++)
{
[Link](a[i]+" ");
}
-----------------------------------------------------------------------
2024 Specimen paper solution
Question 3:
import [Link].*;
class Eshop
{
String name;
double price;
double dis = 0;
double net=0;
void accept()
Page 11 of 50
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the name of the item");
name = [Link]();
[Link]("Enter the price of the item");
price = [Link]();
}
void calculate()
{
if(price >= 1000 && price <= 25000)
{
dis = price * (5.0/100.0);
}
else if(price >= 25001 && price <= 57000)
{
dis = price * (7.5/100.0);
}
else if(price >= 57001 && price <= 100000)
{
dis = price * (10.0/100.0);
}
else if(price > 100000)
{
dis = price * (15.0/100.0);
}
net = price - dis;
}
void display()
{
[Link]("Item name "+ name);
[Link]("price of the item "+ price);
[Link]("net pay name "+ net);
}
public static void main(String args[])
{
Eshop obj = new Eshop();
[Link]();
[Link]();
[Link]();
}
}
Question 5:
import [Link].*;
Page 12 of 50
class Eshop
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter string");
String s = [Link]();
String s1 = [Link]();
int vol=0;
for(int i=0; i<[Link](); i++)
{
char a = [Link](i);
if(a=='A' || a=='E' || a=='I' || a=='O' || a=='U')
{
vol++;
}
}
[Link](s1);
[Link](vol);
}
}
Question 6:
import [Link].*;
class EvenOdd
{
public static void main(String args[])
{
int a[][] = new int[3][3];
Scanner sc = new Scanner([Link]);
[Link]("Enter integer 3*3 values");
for(int i = 0; i<[Link]; i++)
{
for(int j = 0; j<a[i].length; j++)
{
a[i][j] = [Link]();
}
}
Page 13 of 50
for(int j = 0; j<a[i].length; j++)
{
[Link](a[i][j]+" ");
}
[Link]();
}
Question 7:
import [Link].*;
class DuckNumber
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the number");
String s = [Link]();
Page 14 of 50
int len = [Link]();
if(len == 2 || len == 4)
{
[Link]("Invalid");
return;
}
if([Link](0) == '0')
{
[Link]("Not a duck number");
return;
}
else
{
int flag = 0;
if(flag == 1)
[Link]("Duck number");
else
[Link]("Not a duck number");
}
}
}
Question 8:
class Overload
{
void display()
{
for(int i = 1; i<=5; i++)
{
for(int j = 1; j<=i; j++)
{
[Link](j+" ");
}
Page 15 of 50
[Link]();
}
}
void display(int n)
{
while(n >0)
{
int digit = n % 10;
double y = [Link](digit);
[Link](y);
n = n /10;
}
}
public static void main(String args[])
{
Overload obj = new Overload();
[Link]();
[Link](4329);
}
}
----------------------------------------------------------------
2023 Board paper
Question 3:
import [Link].*;
class Student
{
String name, stream;
int age, mks;
void accept()
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the name");
name = [Link]();
[Link]("Enter the age");
age = [Link]();
[Link]("Enter the marks");
mks = [Link]();
}
void allocate()
{
Page 16 of 50
if(mks >= 300)
{
stream = "Science and Computer";
}
else if(mks >=200 && mks < 300)
{
stream = "Commerce and Computer";
}
else if(mks >=75 && mks < 200)
{
stream = "Arts and Animation";
}
else if(mks <75)
{
stream = "Try Again";
}
}
void print()
{
[Link]("name is "+name);
[Link]("age is "+age);
[Link]("marks is "+mks);
[Link]("Stream is "+stream);
}
public static void main(String args[])
{
Student obj = new Student();
[Link]();
[Link]();
[Link]();
}
}
Question 4:
import [Link].*;
class BubbleSort
{
public static void main(String args[])
{
char a[] = new char[10];
Scanner sc = new Scanner([Link]);
[Link]("Enter 10 characters");
for(int i = 0; i<[Link]; i++)
{
Page 17 of 50
a[i] = [Link]().charAt(0);
}
Question 5:
class Overloading
{
void print()
{
for(int i = 1; i<=4; i++)
{
for(int j = 1; j<=5; j++)
Page 18 of 50
{
[Link](i+" ");
}
[Link]();
}
}
void print(int n)
{
int evensum=0;
int oddsum = 0;
while(n > 0)
{
int digit = n % 10;
if(digit % 2 == 0)
{
evensum += digit;
}
else
{
oddsum += digit;
}
n = n /10;
}
if(evensum == oddsum)
{
[Link]("Lead Number");
}
else
{
[Link]("Not a Lead Number");
}
}
public static void main(String args[])
{
Overloading obj = new Overloading();
[Link]();
[Link](3669);
}
}
Question 6:
import [Link].*;
class StringTest
Page 19 of 50
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter string");
String s = [Link]();
int digit=0;
int alp=0;
int spl=0;
Question 7:
import [Link].*;
class LinerarSearchDouble
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
double a[] = new double[5];
[Link]("Enter values");
for(int i = 0; i<[Link]; i++)
{
a[i] =[Link]();
Page 20 of 50
}
Question 8:
import [Link].*;
class OneTwoTest
{
public static void main(String args[])
{
int a[] = new int[10];
Scanner sc = new Scanner([Link]);
[Link]("Enter 10 numbers to array");
for(int i = 0; i<[Link]; i++)
{
a[i] = [Link]();
}
Page 21 of 50
int single=0,two=0;
for(int i = 0; i<[Link]; i++)
{
if(a[i] <= 9)
{
single +=a[i];
}
if(a[i] > 9 && a[i]<=99)
{
two+=a[i];
}
}
[Link]("\nSum of single digit number are "+single);
[Link]("Sum of double digit number are "+two);
}
}
------------------------------------------------
2025 Specimen paper
Question 3:
import [Link].*;
class Bank
{
double p,n,r,a;
void accept()
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the principal amount");
p =[Link]();
[Link]("Enter the time period");
n =[Link]();
}
void calculate()
{
if(n <= 6)
{
r = 9.0;
}
else if(n > 6 && n <= 12)
{
r = 10.0;
}
else if( n > 12 && n <=36)
Page 22 of 50
{
r = 11.0;
}
else if(n > 36)
{
r = 12.0;
}
Question 4:
import [Link].*;
class BinarySearch
{
public static void main(String args[])
{
double a[] = new double[10];
Scanner sc = new Scanner([Link]);
[Link]("Eneter array values");
for(int i = 0; i<[Link]; i++)
{
a[i] = [Link]();
}
Page 23 of 50
int li = 0;
int mi = 0;
int hi = [Link]-1;
double item = 80.0;
int flag=0;
while(li<=hi)
{
mi = (li+hi)/2;
if(a[mi]==item)
{
[Link]("Item found at position "+mi);
flag = 1;
break;
}
if(item > a[mi])
{
li = mi+1;
}
if(item < a[mi])
{
hi = mi -1;
}
}
if(flag == 0)
{
[Link]("Item not found");
}
}
}
Question 5:
import [Link].*;
class StringTest
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the string");
String s1 = [Link]();
String s2 = "";
String s = [Link]();
Page 24 of 50
for(int i = 0; i < [Link](); i++)
{
char ch = [Link](i);
else
{
s2 += (char)(ch - 1);
}
}
else
{
s2 += ch;
}
}
Question 6
import [Link].*;
class SumOfRow
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter values of 4*4");
int a[][] = new int[4][4];
for(int i = 0; i<4; i++)
{
for(int j = 0; j<4; j++)
{
a[i][j] = [Link]();
}
Page 25 of 50
}
[Link]("\nGiven array is : ");
for(int i = 0; i<4; i++)
{
for(int j = 0; j<4; j++)
{
[Link](a[i][j]+" ");
}
[Link]();
}
Question 7:
import [Link].*;
class Superspy
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter number");
int n = [Link]();
int d=0;
int sum = 0;
while(n > 0)
{
int digit = n % 10;
d++;
sum+=digit;
n= n /10;
}
if(sum == d)
Page 26 of 50
{
[Link]("SuperSpy Number");
}
else
{
[Link]("Not a SuperSpy Number");
}
}
}
Question 8:
class Overload
{
void display()
{
for(int i = 1; i<=3; i++)
{
for(int j = 1; j<=4; j++)
{
if(j % 2 != 0)
{
[Link]("1 ");
}
else
{
[Link]("2 ");
}
}
[Link]();
}
}
Page 27 of 50
[Link]("Twice sum of "+n+" and Thrise sum of "+m+" is "+sum3);
}
}
double display(double a, double b, double c)
{
double q = a+b+c;
double p = (a+b)/c;
double z = p * q;
return z;
}
public static void main(String args[])
{
Overload obj = new Overload();
[Link]();
[Link](5,6);
double k = [Link](2.3,3.6,4.9);
[Link](k);
}
}
-------------------------------------------------------------------------------------
2025 board paper
Question 3:
import [Link].*;
class CloudStorage
{
int acno,space;
double bill;
void accept()
{
Scanner sc = new Scanner([Link]);
[Link]("Enter account numner");
acno = [Link]();
[Link]("Enter storage space");
space = [Link]();
}
void calculate()
{
if(space <= 15)
{
bill = space * 15;
}
else if(space > 15 && space <=30)
Page 28 of 50
{
bill = 15 * 15 + (space-15)* 13;
}
else if(space > 30)
{
bill = (15 * 15) + (15 * 13) + (space - 30) * 11 ;
}
}
void display()
{
[Link]("account numner is "+ acno);
[Link]("Storage space is "+space);
[Link]("Bill is "+bill);
}
Question 5:
import [Link].*;
class SuperString
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the string ");
String s = [Link]();
int uc=0,lc=0;
Page 29 of 50
lc++;
}
}
if(uc == lc)
{
[Link]("Super String");
}
else
{
[Link]("Not a Super String");
}
}
}
Question 7:
import [Link].*;
class Overloading
{
void print()
{
for(int i =1; i<=4; i++)
{
for(int j = 1; j<=5; j++)
{
if(j % 2 != 0)
{
[Link]("@ ");
}
else
{
[Link]("# ");
}
}
[Link]();
}
}
double print(double a, double b)
{
double sum =0;
for(double i= a; i<=b; i=i+0.5)
{
sum += i;
}
return sum;
Page 30 of 50
}
int print(char ch1, char ch2)
{
if(ch1 > ch2)
return (int)ch1;
else
return (int)ch2;
}
public static void main(String args[])
{
Overloading obj = new Overloading();
[Link]();
double y = [Link](1.0,4.0);
[Link](y);
int z = [Link]('A','B');
[Link](z);
}
}
Question 8:
import [Link].*;
class LargestSmallest
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the number");
int n = [Link]();
while(n > 0)
{
int digit = n % 10;
if(digit > large)
{
large = digit;
}
if(digit < small)
{
small = digit;
}
Page 31 of 50
n = n / 10;
}
int sum = large + small;
if(sum % 2 == 0)
{
[Link]("Sum is even");
}
else
{
[Link]("Sum is odd");
}
}
}
--------------------------------------------------------------------
2024 Board Paper
Question 3:
import [Link].*;
class Courier
{
String name, address;
int weight,bill;
char type;
int rate;
void accept()
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the name");
name = [Link]();
[Link]("Enter the weight");
weight = [Link]();
[Link]("Enter the address");
address = [Link]();
[Link]("Enter the type");
type = [Link]().charAt(0);
}
void calculate()
{
if(weight <= 5)
{
rate = weight*800;
}
Page 32 of 50
else if(weight > 5 && weight <= 10)
{
rate = 5* 800 + (weight - 5) * 700;
}
else if(weight > 10)
{
rate = 5 * 800 + 5 * 700 + (weight - 10) * 500;
}
if(type == 'i' || type == 'I')
{
bill = 1500 + rate;
}
else
{
bill = rate;
}
}
void print()
{
[Link]("name is "+name);
[Link]("weight is "+weight);
[Link]("address is "+address);
[Link]("type is "+type);
[Link]("Bill is "+bill);
}
public static void main(String args[])
{
Courier obj = new Courier();
[Link]();
[Link]();
[Link]();
}
}
Question 4:
class Overload
{
Page 33 of 50
}
[Link](4, 5);
[Link](2, 6, 'R');
}
}
Question 5:
Page 34 of 50
import [Link].*;
class EvenPal
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter number");
int n = [Link]();
int n1 = n;
int rev=0;
int sum = 0;
while(n > 0)
{
int digit = n % 10;
rev = rev * 10 + digit;
sum += rev;
n = n / 10;
}
if(n1 == rev)
{
if(sum % 2 == 0)
{
[Link]("Evenpal");
}
else
{
[Link]("Not a Evenpal");
}
}
}
}
Question 6:
import [Link].*;
class SumofDiagonal
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
int a[][] = new int[4][4];
[Link]("Enter values of 4*4 array");
Page 35 of 50
for(int i = 0; i<4; i++)
{
for(int j = 0; j<4; j++)
{
a[i][j] = [Link]();
}
}
Page 36 of 50
}
Question 8:
import [Link].*;
class Gmail
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the string");
String s = [Link]();
int flag1=0;
int flag2=0;
int at = [Link]('@');
int dot = [Link]('.');
------------------------------------------------------------
2025 Improvement paper
Page 37 of 50
Question 3:
import [Link].*;
class Hotel
{
String name;
long mobno;
int days, bill;
int cha;
void input()
{
Scanner sc = new Scanner([Link]);
[Link]("Enter name");
name = [Link]();
[Link]("Enter mobile no");
mobno = [Link]();
[Link]("Enter days");
days = [Link]();
}
void charge()
{
if(days <= 3)
{
cha = days * 1000;
}
else if(days > 3 && days <=7)
{
cha = (3*1000)+(days - 4)* 900;
}
else if(days > 7)
{
cha = (3*1000) + (7*900) + (days-7) * 800;
}
bill = cha + (int)(cha * 18.0/100.0);
}
void print()
{
[Link]("name "+name);
[Link]("mobile no "+mobno);
[Link]("days "+days);
[Link]("bill "+bill);
}
public static void main(String args[])
Page 38 of 50
{
Hotel obj = new Hotel();
[Link]();
[Link]();
[Link]();
}
}
Question 4:
import [Link].*;
class Product
{
public static void main(String args[])
{
int a[][] = new int[3][3];
Scanner sc = new Scanner([Link]);
[Link]("Enter the values of 3 * 3 array");
for(int i = 0; i<3; i++)
{
for(int j = 0; j<3; j++)
{
a[i][j] = [Link]();
}
}
Page 39 of 50
}
[Link]("Row "+i+ " "+pro);
}
}
}
Question 5:
class Overload
{
int transform(int n)
{
int sum = 0;
while(n > 0)
{
int digit = n % 10;
sum += digit;
n = n / 10;
}
return sum;
}
void transform(String s)
{
String y = [Link]();
[Link](y);
}
void transform(char ch)
{
for(int i = 1; i<=3; i++)
{
for(int j=1;j<=3; j++)
{
[Link](ch+" ");
}
[Link]();
}
}
public static void main(String args[])
{
Overload obj = new Overload();
int z = [Link](458);
[Link](z);
[Link]("Blue");
[Link]('@');
}
Page 40 of 50
}
Question 6:
import [Link].*;
class SpecialString
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter the string");
String s1 = [Link]();
String s = [Link]();
Question 7:
import [Link].*;
class FirstLast
{
public static void main(String args[])
Page 41 of 50
{
Scanner sc = new Scanner([Link]);
[Link]("Enter numbers");
String s = [Link]();
int f = [Link](first);
int l = [Link](last);
------------------------------------------
KISA 2024
Question 3:
class Bill
{
int units;
int amt;
Bill(int u)
{
units = u;
amt = 0;
}
void compute(int u)
{
if(u <= 100)
{
amt = u * 10;
}
else if(u <= 200)
Page 42 of 50
{
amt = (100 * 10) + (u - 100) * 15;
}
else if(u <= 300)
{
amt = (100 * 10) + (100 * 15) + (u - 200) * 20;
}
else
{
amt = (100 * 10) + (100 * 15) + (100 * 20) + (u - 300) * 25;
}
}
void show()
{
[Link]("Units Consumed = " + units);
[Link]("Bill Amount = Rs. " + amt);
}
Question 5:
import [Link].*;
class StringTest
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
[Link]("Enter String");
String s1 = [Link]();
String s = [Link]();
String s2 = "";
Page 43 of 50
if(ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U')
{
s2 = s2 + '#';
}
else
{
s2 = s2 + ch;
}
}
Question 6:
class Overload
{
void display(char ch, int n)
{
for(int i = n; i >= 1; i--)
{
for(int j = 1; j <= i; j++)
{
[Link](ch);
}
[Link]();
}
}
void display(int a, int n)
{
int sum = 0;
Page 44 of 50
[Link]('*', 5);
[Link](2, 4);
}
}
Question 7:
import [Link].*;
class Peterson
{
public static void main(String args[])
{
Scanner sc = new Scanner([Link]);
int temp = n;
int sum = 0;
while(temp > 0)
{
int digit = temp % 10;
int fact = 1;
if(sum == n)
{
[Link](n + " is a Peterson Number");
}
else
{
[Link](n + " is not a Peterson Number");
}
}
}
Page 45 of 50
Question 8:
class OddSumArray
{
public static void main(String args[])
{
int A[][] = {
{4, 5, 6},
{5, 3, 2},
{4, 2, 5}
};
int sum = 0;
Page 46 of 50