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:

Saturday, March 8, 2014

A Program that calculates the sum of the digits entered by the user successively until the sum reduces to a single digit


In this page I have written the program that calculates the sum successively until the sum reduces to a single digit. For this I have used nested loop as while and do while. For example, 12345=>1+2+3+4+5=>15=>1+5=>6. For more information have a look for the source code and the output below:
The output of the program is:
The main source code for the above program is:


To arrange the entered words in ascending order using string


In the last page I have made the pattern of string. Now lets move forward. In this page I have made the program to find the ascending order of the words entered by the user. For this I have taken two standard library functions called strcmp and strcpy. For more idea have a look for the source code and the program below:
The source code for the above output is:


To display entered string in pattern


In the last program I have started string. Now in this program lets get some more idea about string.
For this I am going to  print string called america in pattern. For more information have a look for the source code and output of the program.
The output displayed is:
The source code for the output given below is:



Friday, March 7, 2014

WAP to print character and address of each character of string


This is the beginning program
of the string. In this page I am going to enter the character and the address of each character will be displayed. For more information have a look for the simple source code and the output of the following program.
The output of the following program is given in the right side:
The source code of the program is:


To find whether the number is palindrome or not using function


In the previous page I have written the program to read the number until user enters 1 and to display the no of even and odd number entered by the user. Now lets do something new. In this page I am going to write the program to find whether the entered .number is palindrome. For this we should know what palindrome means. If the reversed number is equal to the enterd number then the number is said to be palindrome.For example: 343 is palindrome.
The main output of the following program is:
The main source code of the program is:


To check whether the entered number is palindrome or not


In the previous page I have written the program to read the number until user enters 1 and to display the no of even and odd number entered by the user. Now lets do something new. In this page I am going to write the program to find whether the entered .number is palindrome. For this we should know what palindrome means. If the reversed number is equal to the enterd number then the number is said to be palindrome.For example: 343 is palindrome.
The main output of the following program is:

The main source code of the program is:


WAP to read the number until 1 is encountered and also count the number of even and odd number entered by the user


In the last page I have written the program to find the transpose of the entered matrix. Now I have made a program that reads the number until user enters 1 and also display the no of even numbers and the odd numbers entered by the user. For more idea have a look for the source code and the output for the following program.
The output of the program is:
The source code for the above program is"

To find the transpose of the matrix of order m*n using array


In the last page I have  written a program to find the largest number in array. Now lets move towards something new. Now lets find the transpose of the entered matrix.For this we should know what transpose means. Transpose means changing rows into columns and vice versa. To get more idea lets have a look for the source code and the output for the program.







The source code of the above program is:


Thursday, March 6, 2014

To find the largest number in array using function


In the last program I have made the video of engineering drawing. Now lets move towards something new.
In this page I have written the program to find the largest number in an array using function. For this I have supposed the maximum number at first is of  zero position then I have used  the concept of replacing values. I have used argument with return values. For more idea have a look.

Wednesday, March 5, 2014

Video of IOE engineering drawing solution of orthographic projection (tutorial 5 question no 7)




 Here is a solution of ioe engineering drawing tutorial 5 orthographics projection question no 7

Monday, March 3, 2014

To display the sum of the diagonal of the matrix


In this page I have given the concept to find the sum of the diagonal element of the entered desired matrix. For more information have a look for the source code and the output of the program which is given below in this page.
First of all the output of the program is:


The source code for the above output is:


To find the sum of the matrix using function


In this program I have used the concept of finding the sum of the desired matrix using function. For  this the main concept that should be understood is how to pass array into function. I have given an example of 3*3 matrix. The user can make the program of any order using the given source code.
 For more idea have a look for the source code and the output which are given below:
The sample output is :

The main source code of the program is given below:

Saturday, March 1, 2014

To find the largest number from the list of the entered numbers using array


In this page  I have written the program to find the largest of the entered numbers using array. I have used swapping to get the descending order and then have displayed the number at 0 position. For more idea lets have a look for the source code and the output of the following program.





To find out the numbers that are divisible by one number and not by another number using array.



In this page I have written the program to find the numbers that are divisible by one number and not by another number. For more information

To print the pattern of rectangle entering the desired rows and columns


In this I have written the program to print the pattern of rectangle using loop. For more idea the souce code has been given below:

To find the sum of the entered number using function only


In this page I have written the program to find the sum of the entered number using function but not recursion:
It can be done in this way:

To find the sum of the number entered using recursive function


In this page I have written the program to find the sum of the number entered using function. Lets take an example to be clear how the program works.

WAP to enter the values for matrix and display them in matrix form.


In this program I have used array to enter the values and display the values in matrix form. I will elaborate how the program works on the basis of the example given below: