You are on page 1of 9

Problem Solving Using JAVA

Course Code: CSE1004

Module 1 :
Introduction to Problem Solving

Dr. Alok Kumar Shukla


School - SCOPE
VIT-AP Amaravati
Character to Number conversion
ASCII Encoding Scheme

• ASCII- American Standard Code for Information Interchange


• In the early 1960s, computers had no way of communicating with
each other due to different ways of representing keys of the keyboard.
Hence, the need for a common standard was realised to overcome this
shortcoming.
• Thus, encoding scheme ASCII was developed for standardising the
character representation.
• ASCII is still the most commonly used coding scheme.
• Initially ASCII used 7 bits to represent characters i.e. we can
represent 128 characters
Example

public class Exercise


{
public static void main(String[] args)
{
int chr = 'Z';
System.out.println("The ASCII value of Z is
:"+chr);
}
}

The ASCII American Standard Code for Information Interchange


value of Z is :90
Creating and Compiling Programs

• On command line
javac filename.java

• On command line
java filename
Sine Function Computation

Sine series property


• It is a summation series
• It has set of successive terms
• Each new term is opposite of previous
term w.r.t sign.
Sine series algorithm
• Step1 Start
• Step 2 Input and read the value of angle(in degree),x, n.
• Step 3 Convert the angle in degree to radian,x=((x*3.1415)/180)
• Step 4 Assign s = t and t = x.
• Step 5 Initialize i=1.
• Step 6 while(i<n) repeat the steps a to c.
a)Find t=(t*(-1)*x*x)/(2*i)*(2*i+1)
b)Find s=s+t
c)Increment i, i=i+1.
• Step 7 End while.
• Step 8 Print the sum of the sine series s.
• Step 9 Stop
Flow chart

You might also like