New Member FAQ | Forums | Earn Revenue | Posting Guidelines | Help Topics | Admissions 2013
Awards & Gifts
 
Login Login    Register      

ArticlesPractice TestsAsk ExpertsQuestion PapersJobsUniversitiesCollegesCoursesSchoolsTraining

Active Members
TodayLast 7 Daysmore...

Join our online Google+ community for Bloggers, Content Writers and Webmasters




Resources » Articles/Knowledge Sharing » Computer & Technology

Important java programs for computer students for Icse/Isc/Btech examination


Posted Date:     Category: Computer & Technology    
Author: Member Level: Silver    Points: 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.


    Next Resource: Processor, its evolution in the market and Processor types.
    Previous Resource: Blackberry Tablet: Blackberry playbook features review
    Return to Resources
    Post New Resource
    Category: Computer & Technology


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Java program  .  Bluej  .  

    Subscribe to Email
  • Get Jobs by Email
  • Forum posts by Email
  • Articles by Email
  • Online MembersAnand Gaurav
    Hafeez
    D.ANIL KUMAR
    More...


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    AdSense Revenue Sharing sites   Advertise   Talk to Tony John
    ISC Technologies, Kochi - India. Copyright © All Rights Reserved.