Monthly Archives: November 2014

C code for newton-raphson method

Problem: Here we have to find root for the polynomial x^3-8*x-4 upto 6D(decimal places)

Solution in C:

 Output:
2014-11-27 11_48_33-

C code using Weddle’s rule

Problem: Here we have to find integration for the (1/1+x*x)dx with lower limit =0 to upper limit = 6

Algorithm:

Step 1: input a,b,number of interval n

Step 2:h=(b-a)/n

Step 3:If(n%6==0)

Then , sum=sum+((3*h/10)*(y(a)+y(a+2*h)+5*y(a+h)+6*y(a+3*h)+y(a+4*h)+5*y(a+5*h)+y(a+6*h)));
a=a+6*h
and Weddle’s rule is applicable then go to step 6

Step 4: else, Weddle’s rule is not applicable

Step 5:Display output

Code:

Output:

2014-11-27 02_44_27-

C code using Trapezoidal Rule

Problem: Here we have to find integration for the (1/1+x*x)dx with lower limit =0 to upper limit = 6

Algorithm:

Step 1: input a,b,number of interval n

Step 2:h=(b-a)/n

Step 3:sum=f(a)+f(b)

Step 4:If n=1,2,3,……i

Then , sum=sum+2*y(a+i*h)

Step 5:Display output=sum *h/2

 

Code:

Output:

2014-11-27 08_59_58-

C code using Simpson’s 3/8 rule or Simpson’s three by eight rule

Problem: Here we have to find integration for the (1/1+x*x)dx with lower limit =0 to upper limit = 6

Algorithm:

Step 1: input a,b,number of interval n

Step 2:h=(b-a)/n

Step 3:sum=f(a)+f(b)

Step 4:If n is odd

Then , sum=sum+2*y(a+i*h)

Step 5: else, When   n I s even
Then, Sum = sum+3*y(a+i*h)

Step 6:Display output=sum *3* h/8

 

Code:

Output:

2014-11-27 02_44_27-

C code using Simpson’s 1/3 rule or Simpson’s one third rule

Problem: Here we have to find integration for the (1/1+x*x)dx with lower limit =0 to upper limit = 6

Algorithm:

Step 1: input a,b,number of interval n

Step 2:h=(b-a)/n

Step 3:sum=f(a)+f(b)+4*f(a+h)

Step 4:sum=sum+4*f(a+i*h)+2*f(a+(i-1)*h)

Step 5:Display output=sum * h/3

Code:

 Output:

2014-11-26 17_14_31-

Assembly:Write a program to (a) Prompt the user (b) Read HELLO and (c) Display them down the left margin

Solution:

Output:

2014-11-25 22_56_22-

Program to display a 10*10 solid box of asterisks with INT 21H and function 9H

This problem is in charles marut  assembly language book in exercise on chapter 4 …This is 11 number problem

Solution: