Sunday, March 30, 2014

To print pattern of numbers


Lets learn more about printing of pattern of numbers. In this page I have written the program to print the pattern of numbers.
The pattern would be like this:
       1
     123
    12345
  1234567
To get more idea have a look for the source code and the output below:
The source code of the above output is:



Saturday, March 29, 2014

To print the entered string in reverse order without using library function


Lets learn something new about string.In this  page I have made a program to find the reverse order of the entered string without using standard library function.  For more idea have a look at the source code and the printed output given below:
The output of the above program is given below:
The source code of the above output is:



Thursday, March 27, 2014

A program to find the binary equivalent of the decimal number using function


I have written a program to find out the binary equivalent of the decimal number using function. Last time I had written the same program without using function. To have clear idea have a look for the source code and the output below:
The output of the above program is:

The main source code of the above output is:



Saturday, March 15, 2014

Thermodynamics Tutorial No.2 Energy Transfer


1. A gas undergoes compression from an initial state of V₁ =0.1 m3, P₁ =200 KPa to a final state of V₂ =0.04 m3, P₂ =500 KPa. If the pressure varies linearly with volume during the process, determine the work transfer.

2. A gas undergoes  a polytropic process from an initial of 500 KPa and 0.02 m3 to a final state of 100 KPa and 0.05 m3. Determine the work transfer.
3. In a non flow process,a gas expands from volume 0.1 m3 to a volume of 0.2 m3, according to the law : P =2/V +1.5 where P is the pressure in bar, and V is the volume is m3. Determine (i) the process at the end of the expansion and (ii) the work done by the gas in the expansion process in kJ.

4. Consider a two part process with an expression from 0.1 m3 to 0.2 m3 at a constant pressure of 150 KPa followed by an expression from 0.2 m3 to 0.4 m3 with a linearly rising pressure from 150 KPa ending at 300 KPa. Show the process in a P-V diagram and find the boundary work.

5. Air undergoes three process in series to form a cycle: Process 1-2: constant volume cooling, V₁ = V₂ =2 m3 Process 2-3: constant pressure heating, P =100 KPa, V₁ = 10 m m3 Process 3-1: isothermal compression

6. Argon (1 kg) contained in a piston cylinder device shown in Figure P2.6 is initially at a pressure of 500 KPa and a temperature of 70°C. Heat is added until the final temperature is 600°C and a pressure
of 1 MPa is required to lift the piston form the stops. Sketch the process on P-V and T-V diagrams and determine the total work transfer. [Take R =208 J/kg k]

7. Air (0.5 kg) in the piston cylinder shown in Figure P2.7 has an initial pressure and temperature of 1 MPa and 500°C repectively. The system is
cooled until the temperature reaches 50°C. It takes a pressure of 0.5 MPa to support the piston. Sketch the process on P-V and T-V diagrams and determine the total the total work transfer. [Take R = 287 J/kg k]

8. Oxygen (3.6 kg) contained in a piston cylinder device shown in Figure P2.8 is initially at a pressure of 200 KPa and temperature of 50°C. Heat is 3. It requires a pressure of 500 KPa to lift the piston. Sketch the process on P-V and T-V diagrams and determine the total work transfer. [Take R =260 J/kg k]
added until the piston just reaches the upper stops where the total volume is 3 m

9. A piston cylinder device shown in Figure P2.9 contains 1 kg of Nitrogen initially at a pressure of 250 KPa and a temperature of 500°C.Heat is lost from the system till its temperature reaches 25°C. Sketch the process on P-V and T-V diagrams and determine the final pressure and the total work transfer. [Take R =297 J/kg k]

10. A piston cylinder arrangement loaded with a linear spring (k =2 kN/m) as shown in Figure P2.10 contains air. Spring is initially unstretched and undergoes a compression of 40 mm during a process. If the mass of the piston is 80 kg and piston diameter is 0.1 m, determine the total work transfer. [Take Patm = 100 KPa and g =9.8 m/s2]

11. Air (0.01 kg) is contained in a piston cylinder device restrained by a linear spring (k = 500 kN/m) as skown in Figure P2.11. Spring initially touches the piston but exerts no force on it. Heat is added to the system until the piston is displayed upward by 80 mm. Determine (a) the temperature at which piston leaves the stops (b) work done by air [Take R = 287 j/kg k, Patm = 100 KPa and g = 9.81 m/s2]

12. A piston cylinder arrangement shown in Figure P2.12 is restrained by two linear springs as shown. The system contains air initially at a pressure of 150 KPa and a volume of 0.002 m3. Heat is added to the system until its volume doubles; determine the total work transfer. Also sketch the process on P-V diagram. Both springs have spring constant of 100 kN/m.

Thursday, March 13, 2014

What exactly C is?



image credit: shareprogrammingtips.com
C is a high level programming language developed by Daniel Ritchie at Bell Laboratories by 1970s. C began more popular in the late seventies and began to replace the programming language at that time like PL/I, ALGOL,etc. Thus without advertisement C's reputation spread and its pool of users grew.It seems to be surprised that so many programmers preferred C to older programming language like Fortran or PL/I,or the newer ones like pascal and APL.


Why C became more popular than other programming language??
1. It is very difficult to learn C++,C# or JAVA directly. Learning these complicated concepts like C++,C# when we are not even comfortable with basic programming language is like putting the cart before the horse. Hence to learn complicated language like C++ we should have thoroughly knowledge about C.

2. Major parts of popular operating systems like Windows, UNIX,Linux are still written in C. This is because even today when it comes to performance and execution none other programming language could beat C.

3. In 3D computer games there is the essence of speed. Such games would not become popular if they they take long time to move spaceship or to fire a bullet. To match the expectation of the player the game has to react fast to the user inputs. This is where C language scores over other programming language. Many popular gaming frameworks like (DirectX) has been built using C language.

4. C provides several language elements that make the interaction between user and the hardware device feasible without compromising the performance, hence it is preferred choice of programmers.

Sunday, March 9, 2014

To display the pattern


As earlier page in this page also I have written the program to display the following pattern.
0
1 0
0 1 0
1 0 1 0
0 1 0 1 0
1 0 1 0 1 0
The output for the above program is:
The source code for the above program is:


To display pattern of numbers


In this page I have written a simple program to display the pattern of numbers. To get more idea have a look for the source code and the output of the following progr
The output of the following program is:
The source code of the above output is: