Resources » Articles/Knowledge Sharing » Computer & Technology

Important JAVA Programs For Computer Students For ICSE/ISC/BTech Examination


Updated: Category: Computer & Technology
Author: Member Level: SilverPoints: 10


These programs are written in bluej java computer for icse / isc/ Btech/BscIT/BCA students. First program is permutation-combination type and second program find out the co-primes.Given programs helps to all types of computer students not only for examination but also for their project work.



Q1.A person has n number of sons and n square number of cows.Each cow gives milk as per their serial number. For example cow number 1 gives 1 liter milk, cow number 2 gives 2 liter of milk and so on.Write a program in bluej(java) to solve the above problem



Solution 1:-

class cows
{
public void abc(int n)
{
int cows=n*n;
int a[][]=new int [n][n];
for(int i=0;i{
a[i][i]=i+1;
}
int d=n;
for(int j=0;j{
for(int k=0;k{
if(j!=k)
{
a[k][j]=d+1;
d=d+1;
}
}
}
for(int p=0;p{
int w=p+1;
System.out.print(w+"number son will get cows with serial numbers------");
for(int q=0;q{
System.out.print(a[p][q]+",");
}
System.out.println(" ");
}
}
}
** Input number of sons:-5
** Output number of cows:-1number son will get cows with serial numbers------1,10,14,18,22,
2number son will get cows with serial numbers------6,2,15,19,23,
3number son will get cows with serial numbers------7,11,3,20,24,
4number son will get cows with serial numbers------8,12,16,4,25,
5number son will get cows with serial numbers------9,13,17,21,5,

Q2.Program to find out the co prime numbers- written in Bluej(java)

Solution 2:
class AP
{int s;
public void abc(int a,int b,int n)
{
if(a>b)
{
for(int i=1;i<=b;i++)
{
if(a%i==0)
{
s=s+1;
}
}
if(s==0)
{
System.out.println("The numbers are coprime");
for(int j=0;j{int k=a+j*b;
System.out.print(k);
}
}
}
else
{
for(int i=1;i<=a;i++)
{
if(b%i==0)
{
s=s+1;
}
}
if(s==0)
{
System.out.println("The numbers are coprime");
for(int j=0;j{
int k=b+j*a;
System.out.print(k);
}
}
}
}
}
Related Resources:


Read related articles: JAVA program   

Did you like this resource? Share it with your friends and show your love!




Responses to "Important JAVA Programs For Computer Students For ICSE/ISC/BTech Examination"
Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index
    Complete the action items below to enter to win an iPad Mini from India Study Channel! in India Study Channel - Locker on LockerDome
    Awards & Gifts
    Active Members
    TodayLast 7 Daysmore...

     
    ISC Technologies, Kochi - India. © All Rights Reserved.

    
    
    
    

    Click the "Follow" button above to follow Tony John