Bluej 100 Programs
Prasanta Nandi
Content
Program to compute and print all prime numbers between 100 and 500
Program to display all armstrong numbers between 100 and 1000.
Program to create a 3x3 matrix and store the first nine // natural numbers row wise // The program should further display the sum of rows, // columns and diagnols
Program to display the name of the week day as per the entered number
Write a program to input any number and print the //same in reverse.
Program to display the sum and and average of all even and odd numbers // between 1 and 100.
Write a program to input any ten numbers and print the maximum and minimum.
Program to input a number and print its even factors
Write a program to define a function fact() to compute the factorial of any entered number.
Create a program to define a function found() // to print the Highest Common Factor of any two numbers.
Program to print the characters of the string present at odd positions. public
Write a program to define and utilize a function perfect(), to print all perfect numbers from 1 to 100. ( A perfect number is a number which is equal to the sum of its factors eg. 6=1+2+3, hence 6 is a perfect number).
Write a program to compute prime factors of any entered number with the help of a function pfact().
Program to input a number and print its binary equivalent.
Sorting string using Bubble Sorting Technique
Description: Its a simple program which calculates the day of the week for any given date & month of the year 2002.
Program to display the Pascal’s Triangle // pascal triangle
Develop a program to input any number // and print them in descending order without using the sorting technique.
Code a program to compute the prime factors of any number // using a function
Program to display all prime fibonacci series between 1 to 10000
Program to input any string and display the number of vowels. public
ogram which replaces each character in s by the character which is at a distance of move ahead, if move is positive. If move is 0 the original string is returned unchanged. If move is negative, then each character is replaced by a character at a distance move behind it. For example: When s=”ABCXYX”, encodeDecode(2) returns “CDEZAB” and When s=”ABCDE”, encodeDecode(-3) returns “XYZAB” [ICSE Sample Paper-2005]
Program to input a string and print each word in reverse. public
Program to print the frequency of all the characters within a string. public
Program to display the output as: // 55555 // 54444 // 54333 // 54322 // 54321
Program to Sort an array using Bubble Sort Method
Program to sort numbers using Selection Sort Method
Program to sort any array of numbers using Insertion Sort Method
Program to perform Binary Search in an array of numbers:
Program to perform Linear Search in a given array of numbers:
Displaying the sum of row and columns of a double dimension array.
Program to enter a number and sort the digits in ascending // order. Display the new digit so obtained.
Store N elements in an array WORK and compute the total number of // times M occurs in WORK. Where N and M are the inputs alongwith the // elements of the array. Program to print the frequency of M in an // array of N elements.
Returns true if n is a prime false otherwise // assume n is >1 // initialise instance variables int x=0; int count = 0; for(x=2;x
Program to compute the middle digit of any entered number. If the number does not have a middle digit, it has to return the average of the middle two digits.
A palindrome number is one that reads same from left to right or right to left. There is an ingenious method to get a palindrome from any positive integer. The procedure is as follows: Start with any positive number of 2 or more digits. Obtain another positive number by reversing the digits of the starting number. Add the two numbers together. Repeat the whole procedure with the sum as the starting number till you get a sum which is a palindrome number. // Program to calculate the palindrome of a given number in maximum 15 terms. Assu
Program to print the sum of factorial of the digits of an entered number.
Example
Example Class definition to demostrate the increment operators. public
Example program to demonstrate the // usage of implicit or automatic type conversion public
Example program to demostrate the // usage of if else statement
Example Class Definition to demostrate the // usage of if else if statement
Program to input marks in five subjects // and display the grade.
Program to enter a number and check if it is a prime
Program to enter any number (max 3 digits) and check the nature of its digits.
Program to input a number and print its odd factors
Program to input a number and print the average of its factors
usage of relational operators public
printing sum of two numbers or product of two numbers according to the // entered choice 1-sum, 2-product, 3 or any other from 1 or 2, // display wrong code. switch(ch) { case 1: System.out.println(“The sum of entered two numbers is “+(x+y)); break; case 2: System.out.println(“The product of the two numbers is”+(x*y)); break; default: System.out.println(“Sorry this choice is invalid”); } }
To calculate the factorial of any number using multiple initialization expressions.
Program to print prime factorization
To print the sum of the folowing series : // s = a/1 + a/2 + a/3 +......+ a/n. Where a =2 and n=10 are the inputs. // Example program to display the sum of the series
Program to print a triangle as follows: // Class to display the following format //1 //12 //123 //1234 //12345
To print the first ten terms of the fibonacci series: // Example
To print the sum of first 100 natural numbers. // Example program to print the sum of first ten // natural numbers using do-while
Program to enter a number // and print the number of odd numbers from 1 to the number, even numbers // and also the summation of odd and even numbers.
Program to input a number and check if it is an // armstrong number. A number is said to be armstrong // if it is equal to the sum of the cubes of its digits.
Program to input a number and print its even factors
To calculate the square of any ten numbers.
Example Program : Using break and continue
Program to display the following series. // -1+2-3+4.......n
To Display the output as: // 1234554321 // 1234 4321 // 123 321 // 12 21 // 1 1
Develop a C++ program to input any number //and print the sum of its first and the last digit.
This program finds the integer between 1 and 10000 that has the largest number of divisors. //It prints out the maximum number of divisors and an integer that has that many divisors. public
Class to input any two numbers and compute their LCM and HCF public
Special Number Program // A number is said to be special if the sum of factorial // of each digit is equal to the number.
Program to display all armstrong numbers between 100 and 1000 using arrays
Program to input a number and print its binary equivalent.
Program to enter a number and sort the digits in ascending // order. Display the new digit so obtained.
Example program to display the magic square of an entered value of n and x. // where n is the number of terms required for the array (nxn) and x is the value of the first element.
This
Develop a program to input any number and print the sum of its digits.
Program to implement icrement and decrement operators public
Program to define a negation
The Arithmetic
Program to demonstrate Bitwise Operation In JAVA
Program to implement relational Operators
Program to implement arithmetic on float values.
Program to display nested for looping
Program to compute the average, Standard Deviation and sumof squares. /** * A
Program to compute the factorial
Program to print the first 20 numbers of the fibonacci numbers. public
Program to sort a list of numbers generated randomly. public
Program to frame a simple calculator with functions like add, sub, mult, divide. public
Program to input name and marks in five subjects and compute avg. and select the subjects available. public
Program to print the reverse of any entered string. public
Program to arrange an entered string in Alphabetical order. public
Develop a program to input a list of elements in a double dimensional array of 3x3 and print the maximum and the minimum elements alongwith their location within the array.
Program to Sort a given Array in Descending Order
This function allows the user to enter a number and than rounds it off, // correct to the nearest integer.
Program to display a Triangle of numbers called the Pascal's Triangle, //when provided with the number of rows.
This program creates a magic square box of order n x n. // The speciality of a magic square box is that the sum of elements of //any row or any column // is always equal. // Enter the row of matrix and the starting index of matrix number generation
Program to check if any entered number is a Magic Number
Program to input any number and display the sum of its digits
Program to print a triangle as follows: //1 //12 //123 //1234 //12345
Program to enter any number (max. 3 digits) and check the nature of its digits.
Program to input a number and print its binary equivalent.
Program to enter a number and sort the digits in ascending // order. Display the new digit so obtained.
to extract and display the maximum prime digit from a number
Program to display the following output: // 11 // 12 22 // 13 23 33