This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Thursday, May 31, 2012

Physics 1 Lab

Assalamu Alaikum. Hope, you all are well by the grace of Almighty. You will found some necessary files for Physics 1 Lab in the following.




Imp. Viva Ques 4 Mid

Thank you all..:)

Wednesday, May 16, 2012

if else statement: Descending Order

Hello Friends!!! Hope, you all are well by the grace of Almighty ALLAH. Today we learn how to find out the descending order of three integer numbers. Let's look ate the problem.

Problem: Write a program that takes three integer numbers and output the numbers in descending order (large to small).


Sample input: Enter the numbers: 1 2 3
Sample Output: The descending order is : 3, 2, 1


Solve:




















We can also do this program by the following way:




















Thank you all..:)

if else statement: Ascending Order

Hello Guys!!! Hope, you all are well by the grace of Almighty ALLAH. Today we learn how to find out the ascending order of three integer numbers. Let's look at the problem:

Problem: Write a program that takes three integer numbers and output the numbers in ascending order. (small to large).

Sample Input: Enter the Numbers: 1 2 3
Sample Output: The ascending order is: 1, 2, 3

Solve:




















We can also do this program by the following way:





















Thank you all..:)

if else statement: uppercase to lowercase char/lowercase to uppercase char

Hello Guys!!! How are you? Hope, you all are well by the grace of Almighty. Today we do a c programming code about uppercase-lowercase conversion. Let's look at the problem.

Problem: Input a character. If the character is between "A"-"Z" convert to small letter. If the character is between "a"-"z" convert to capital letter.

Solve:




















We know that, the ASCII value of "a" is 97 and "z" is 122. In the first condition, this is applied. We also know that, the ASCII value of "A" is 65 and "Z" is 90. In the second condition this is applied.

We can also do this program by the following way:























The difference between any ASCII value of lowercase and uppercase character is 32. In this program, this is used. In line 12 and 17 "x-=32" & "x+=32" means "x=x-32" & "x = x + 32".

We can also do this program by the following way:



















In this program, "ctype.h" header file is used. toupper and tolower are library functions. toupper function converts any character into uppercase character & tolower converts any character into lowercase character.

Thnak you all..:)

Size of Data Types

Hello Guys!!! How are you all?? Hope, you all are well by the grace of Almighty ALLAH. Today we learn to write the C programming code about size of Data Types.Let's look at the program:













Thank you all..:)

Tuesday, May 15, 2012

Find Out Minimum

Hello Friends!!! How are you all? hope, you all are well by the grace of Almighty.Today we learn to find out minimum integer from the two or three numbers. Let's look at the problem.

Problem 1: Find out the minimum between two integers.

Solution:  






















We can also write this code by the following way:



















Problem 2: Find Out the minimum among three integer numbers.

Solution: 



























We can also write this code by following way.




















We can also write this code by following way.





















Thank you all..:)

Find out Maximum

Hello Guys!!! How are you all ? Hope, you all are well by the grace of Almighty ALLAH. Today we learn how to find out the maximum number from two/three numbers.Let's look at the problem.

Problem 1: Find out the maximum between two integer numbers.

Solution: 























We can also do this program's code by following way:




















Problem 2: Find out the maximum among three integer numbers.

Solution:






























We can also do this code by the following way:



















We can also do this code by the following way:
























We can also do this code by the following way:



















Thank You all..:)

if else statement : odd or even

Hello Guys!!! How are you all ?? Hope, you all are well by the grace of Almighty ALLAH. Today we learn how to find an odd or even number.

Generally we know, if any number is divided by 2 except 0 and any negative number it is called even number, else it is called odd number. By using this formula we can write C programming code. Let's look at the program.



















Thank you all..:)

If Else Statement (Conditional): Beginning

Hello Guys!! How are you, all? Hope you all are well by the grace of Almighty ALLAH. Today we learn about the conditional Statement.

Conditional Code:

  • The if statement.
  • The if.....else statement.
  • The if.....else if.....else statement.

Conditions:

  1. Using relational or conditional operators.
  2. Using logical operators.

Relational or conditional operators:

  1. == means 'is equal to'
  2. !=  means 'is not equal to'
  3. <   means 'is less than'
  4. >   means 'is greater than'
  5. <= means 'is less than or equal to'
  6. >= means 'is greater than or equal to'

Logical Operators:

  1. &&  means 'AND'
  2. ||      means 'OR'
  3. !      means 'NOT'

Note: Result of the condition is always wither true(1) or false(0)

Example: 

1>2       Ans. 0
1<2       Ans. 1
1==2     Ans. 0
If the value of the condition is any positive or negative number except 0 or 1, it always consider that number as a true value.

The If Statement

if (condition)
{
    statement;
}

Multiple statement within If

if (condition)
{
    statement 1;
    statement 2;
    -----------;
    statement n;
}

The if else statement

if (condition)
{
    statement 1;
    statement 2;
}

else
{
    statement 1;
    statement 2;
}

The if-else if-else statement

if (condition)
{
    statement 1;
    statement 2;
}

else if (condition)
{
    statement 1;
    statement 2;
}

else
{
    statement 1;
    statement 2;
}


Thank you all..:)

Saturday, May 12, 2012

Interchange the values of Two Integers

Hello Friends!!! How are you? Hope, you all are well by the grace of Almighty. Today we learn how to interchange two integer numbers.

Problem: Write a program to interchange the value of two variables, say x and y.


Solve:






















In this code, to interchange the values of x and y, a temporary variable called "t" has been declared. Then, scan the values of x and y. After that, the value of x is assigned in t, the value of y is assigned in x and the value of t is assigned in y. Thus we interchange the values of x and y.

Thank you all..:)

ASCII Value

hello Guys!!! How are you, all? Hope, you all are well by the grace of Almighty ALLAH. Today we learn how to find the ASCII value of a ASCII character.

Problem:  Write a program that takes a character as input and outputs the ASCII value of that character.


Solve:


ASCII stands for American Standard Code for Information Interchange. Computer can only understand numbers, so an ASCII is the numerical representation of a character such as 'a' or '@' or an action of some sort. Let's look at the program:


















This code is also be written by following way:
















You can download the ASCII table from here.

Thank you all..:)

Expression Evaluation: Electrical Force

Hello Friends!!! hope, you all are well by the grace of Almighty. Today we learn how to find out the electrical force. Let's look at the problem.

Problem:  Calculate the electrical force F between charges q1 and q2 separated by a distance r meters using Coulombs Law as given below. Charge quantities q1 and q2 are input data in this problem and force F is the output quantity. The value of  Epsilon naught is 8.85E-12 F/m is a constant quantity and ignore units.


F = (q1 x q2)/ (4 x pi x epsilon naught x r x r).


Solve:
































In this program #define is used. We define the value of pi after the header file. #define is used by following way:

#define constant_name constant_value


"E" is used for "10^". If we want to see result in "E" format, we have to use "%E". In this program it is used.

Thank you all..:)

Friday, May 11, 2012

Expression Evaluation: Count 25 paisa, 50 paisa

Hello Friends!! How are you all? Hope, you all are well by the grace of Almighty. Today we solve a paisa  problem. Let's look at the problem and solve.

Problem: In Bangladesh previously ( Before 5 taka and 1 taka ) the most accepted coins were 50 paisa and 25 paisa. Write a program that will input the total amount in taka and convert it to 50 paisa coins and 24 paisa coins.


Sample input and Output:


Enter amount: 4.75
50 paisa coins: 09
25 paisa coin: 01


Solve:




















Thank you all..:)

Expression Evaluation: Digits to Number

Hello Friends!!! How are you? Hope, you all are well by the grace of Almighty. Today we learn how to convert digits to a number.

How can we convert four digits to a number?? If we multiply last digit with 10^0, 2nd last digit with 10^1, 2nd digit with 10^2, 1st digit with 10^3 and add all results then we find a number. It's simple way to convert four digits to a number.

Now we can apply this formula for C coding. Let's look at the program:





















Thank you all..:)

Thursday, May 10, 2012

Expression Evaluation: Separate Digits from a Four digits integer number

hello guys!!! Hope, you all are well by the grace of Almighty ALLAH. Today we learn how to separate digits from a four digit integer number.

We can try the following process of separating digits from a integer number:

If the number is 1234, then when we divide it with 10, we will find "4" as the remainder. Then again we divide the number with 10. Then, we will find 123 as quotient. After this, again we divide 123  by 10 and find "3" as the remainder. Then, if we divide 123 with 10, we will find 12 as quotient. After this, when we divide 12 by 10 we will find "2" as remainder. Then when we again divide 12 by 10, we will find "1" as quotient.

Now, "1", "2", "3" & "4" are the separated digits.

Now, we can write C programming code by using this formula. Let's look at the program:

















Thank you all..:)

Expression Evaluation: Sum from 1 to 100 or any number

Hello Guys!!! How are you, all? Hope, you all are well by the grace of Almighty ALLAH. Today we learn how to sum from 1 to any number.

generally we know that,

summation of n numbers = n x (n+1) / 2 .
Now, we can write a C programming code by using this formula. Let's look at the program:
















In this code, if the input is 100, then output will be:

Output: Enter the value of n: 100
            Sum: 5050




Thank you all..:)

Expression Evaluation: Sum & Average

Hello Guys!!! How are you ? Hope, you all are well by the grace of Almighty. Today we learn how to find out the sum and the average of some integer numbers. Let's look at the problem:

Problem:  Write a program that receives five integers and returns the sum and average of these numbers.

Solve:

Generally we know that, if five integers are a, b, c, d, & e,
their sum = (a+b+c+d+e) 
their average = (a+b+c+d+e) / 5
Now, we can write a c programming code by using this formula. Let's look at the program:
















In this code, in line no. 12, we can write any of this two: "avg=sum/5.0;" or, "avg=sum/(float)5;".

Thank you all..:)

Expression Evaluation: Area of a Trapezium

 Hello Friends!!! How are you? Hope, you all are well by the grace of Almighty ALLAH. Today, we learn how to find out the area of a Trapezium.

Generally we know that, the area of a Trapezium = (Half the sum of parallel sides) x (Perpendicular Distance between the parallel side). Now, we can write a C programming code using this formula.Let's look at the program:















In this program the ASCII character of 1/2 is used and it's ASCII value is 171.

Thank you all..:)

Expression Evaluation: Area of a Circle

Hello Guys!!! How are you? Hope, all of you all well by the grace of Almighty ALLAH. Today we learn how to find out the area of a circle.

Generally we know that the area of a circle = 3.1416(pi) x radius x radius. Now we can write a C programming code by using this formula. Let's look at the program:













In this code, the ASCII character of pi and square is used. Their ASCII values are 227 & 253.

Thank you all..:)

Expression Evaluation: Area of a Square

Hello Guys!!! How are you ? Think you all are well by the grace of Almighty. Today we will learn how to find out the area of a square.

Generally, we know that, the area of a square = length x length. Now, we can write a C programming code by using this formula. let's look at the program:












In this Code the ASCII character of square is used and it's ASCII value is 253.


Thank you all...:)

Expression Evaluation: Area of a Triangle

Hello guys!!! Hope, you all are well by the grace of Almighty ALLAH. Today we learn how to find out the area of a Triangle.

Generally, we know that the area of a triangle = 0.5 x base x height. Now, we can write a C programming code by using this formula. Let's look at the program:













In this code The ASCII character of 1/2 is used and it's ASCII value is 171.


Thank you all..:)

Expression Evaluation: Area of a Rectangle

Hello guys!!! How are you all?? Hope, you all are well by the grace of almighty ALLAH. Today we learn how to find out the area of a rectangle.

Generally, we know that, the area of a rectangle = length x width. Now we can write a C programming code by using this formula. Let's look at the program:













Thank you all..:)

Wednesday, May 9, 2012

Expression Evaluation: Division

Hello guys!!! Hope, you all are well by the grace of Almighty. Today we learn, how to divide in C programming. Let's look at a program:













Output: Division: 10 / 3 = 3


This program is wrong because all of us know that 10 / 3 = 3.33. 3.33 is a float number. so, we can try this code by letting "s" as a float variable. let's look:













Output: Division: 10/3 = 3.000000


This program is wrong too because the result is wrong. so, we can try this code by letting all variables "a", "b" & "s" as a float variable. Let's look:













Output: Division: 10.000000 / 3.000000 = 3.333333


Now, this program is correct. But it is looking odd. If we want our output as 10 / 3 = 3.33, then we have to write this program in this way:


















Output: Division: 10 / 3 = 3.33


Now this program is perfect. In this program in line no. 8, i write "s=(float)a/b". This is called "Type Casting". We cast "a" to float from int variable. Why we cast ?? Because when divide two numbers, it's result and any of one must be in a float variable. If two numbers are integer then we have to cast any of these numbers. We can also write this code by following way:













Output: Division: 10 / 3 = 3.33

We can also Make an integer number to float number by adding ".0" with it.

Thank you all..:)

Expression Evaluation: Multiplication

Hello guys!!! How are you all ? Hope, all of you are well by the grace of Almighty. Today we learn how to multiply a number with another number. Let's look at a program:













Output: Product: 15


We can also write this code in the following way:












Output: Product 15

If we want to scan the two integer numbers, then the code is looked like the following:














Output will depend on input. If the two inputs are "5" & "3"  then output will be:

Enter Two Numbers: 5  3
Product: 15


If we the output more clear, then we can write code the following way:













If the inputs are "5" & "3", then the output will be:

Enter Two Numbers: 5 3
Product: 5 * 3 = 15

Thank you all..:)

Tuesday, May 8, 2012

Expression Evaluation: Subtraction

Hello guys!!! Hope all of you are well by the grace of Almighty. Today we will learn how to subtract a number from another number. Let's look at a program:












Output: Subtraction Result: 5

we can also do this code in this way:













Output: Subtraction Result: 5

If we want to scan the two integer numbers then the code is looked like the following:













Output will depend on input. If inputs are "10" & "5", then output will be:

Enter Two Numbers: 10 5
Subtraction result: 5


If we want output more clear, then we can code the following way:













In this code if inputs are "10" & "5", the output will be looked like:

Enter Two Numbers: 10 5
Subtraction: 10 - 5 = 5

Thank you all...:)

Expression Evaluation : Addition

Hello guys!!! How are you ?? Think all of you are well by the grace of Almighty. Today we will learn how to add a number with another number in C. Let's look at a program :














Output: Summation: 15

First of all we write a header file  #include<stdio.h>. Then write main function. In main function, from "int a" to "int sum" part is called declaration. Then from "a=5" to "sum=a+b" part is called initialization. Then we print the result. In this program, first of all we take three integer  type variables called "a", "b" and "sum". Then we initialize  5 into "a" and 10 into "b". In the variable "sum" we initialize "a+b". Finally we print the value of "sum". Here "\n" is used for new line.

We can initialize all same type variable & declare variable and initialize at the same time. we can also print the value of  "a+b" without it's value in another variable. If we do it, then this code is look like following:










Output: Summation: 15


If we want to scan the two integer numbers then the code is looked like the following:












Output will depend on input. If inputs are 5 & 10, output will :
Enter Two Numbers: 5 10
Summation: 15


In scanf we scan the address of two variables "a" & "b". In printf generally we print the value of variable.

If we want output more clear, then we can code the following way:













If inputs are "5" & "10", the output will be:

Enter Two Numbers: 5 10
Summation: 5 + 10 = 15


Thank you all...:)