Anda di halaman 1dari 6

1) Input a radius from a user and print the area of the circle and

circumference of circle.
2) Input the value in Fahrenheit use the formula C = (F-32)5/9 and
convert that into Centigrade.
3) Input 3 values from user and print the sum of these three values.
4) Write your name in given format. (Use only printf, \n, and \t).
*******************************
**
* your name *
*******************************

5) Write a prog to solve the Quadratic equation. Program takes the


values a, b, c and uses this formula to solve.

6) Write a prog, which input your date of birth in the form of years,
months, days and then covert into second.
7) Write a program, which input two dates, (the current year,
month, days, hours and seconds) and (birth year, month, days,
hours and seconds) and then tell your age in (year, month, days,
hours and seconds)
Write a program, which scroll your name on screen.
9) Seeing Q.No 4 and draw the boxes and your name. (Using
gotoxy and for loop)
10) Write a program, which input a number from user and print its
modulus value.
11) Write a program which input temperature (centigrade) from
user and print the output according to this criteria
o If temp below than 45 it is very hot (temp<45 = VERY HOT)
o If temp below than 30 it is hot (temp<30 = HOT)
o If temp below than 20 it is Normal (temp<30 = Normal)
o If temp below than 10 it is Pleasant (temp<30 = Pleasant)
o Else Cold
12) Write a program, which input Numeric from 0-9 and print its
corresponding values. eg Entering 1 show one.
13) Write a program, which input any keyboard character and
prong either it is Alfa, numeric, arithmetic operator, brackets,
vowel, or other character.
14) Write a program to add five numbers using scanf statement.
15) Write a program to input the names and weights three things
purchased. (i.e.Mangoes.5kg, Sugar.2kg, and alt.1kg) and print
their names and weight on screen.
16) Write a program to read the values of A, B, C, D, E and
calculate X by the formula. X=A3+B2+C+D/E. .
17) Write a program to find out the total expenses of a firm by the
formula Total expenses=Bills + Rent + Marketing +Misc.
18) Write a program to input principle (P), Rate(R), and Time (T)
and calculate interest by the formula: I=(P R T)/100. Print the input
values and result on screen.
19) Write a program to add two numbers and find out their square
by the formula: (a + b) 2
20) Write a prog, to input 2 numbers find out their difference and
square of difference by the formula. (a-b)2
21) Write a program to get the values vf, vi, a, t and solve
following equation : vf = vi+at
22) Write a program to get the values of a, s, vf, vi, and solve the
following equation: 2as= vf2-vi2
23) Write a program to find the smallest values or smallest number
by using logical operator.
24) Write a program to get a number from 1 to 5 and return either
the number is less than 2, equal to 2 or greater than 2.
25) Write a program to accept 3 numbers and print the smallest
number on screen.
25:

package javaapplication13;

import java.util.*;

/**

* @author Bilal Mehmood

*/

public class Main {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

// TODO code application logic here

Scanner s = new Scanner(System.in);

System.out.println("Enter Value1");

int value1 = s.nextInt();

System.out.println("Enter Value2");

int value2 = s.nextInt();

System.out.println("Enter Value3");
int value3 = s.nextInt();

if (value1<value2 && value1<value3)

System.out.println("Value1 is Smallest "+value1);

else if (value2<value1 && value2<value3)

System.out.println("Value2 is smallest "+value2);

else

System.out.println("Value3 is smallest "+value3);

24:

package javaapplication13;

import java.util.*;

/**

* @author Bilal Mehmood

*/

public class Main {

/**
* @param args the command line arguments

*/

public static void main(String[] args) {

// TODO code application logic here

Scanner s = new Scanner(System.in);

System.out.println("Enter Value from 1 to 5");

int value = s.nextInt();

//System.out.println("Enter Value2");

//int value2 = s.nextInt();

//System.out.println("Enter Value3");

//int value3 = s.nextInt();

if (value<2)

System.out.println("Value is Less than 2 ");

else if (value==2)

System.out.println("Value is Equals to 2 ");

else

System.out.println("Value is Greater than 2 ");

Anda mungkin juga menyukai