Posts

Hello word!

JAVA File program πŸ˜€

Loop control statement

Image
Table of Content Introduction of loop Types of loop while loop do while loop for loop nesting of loop infinite loop odd loop difference between while loop and do while loop Introduction of loop  Loop are used when we want to execute a block of statement or a part of program at multiple times. suppose a program to print " hello world " 20 times. one way to get the desired output using printf statements, which is bad programming skill or not preferable . other way we can use loop to print the "hello world " easily.   Now I can demonstrate to you print " hello world " without using loop. /*Program to print "hello world" without using loop*/ #include <stdio.h> int main() {     printf( "hello world\n" );     printf( "hello world\n" );     printf( "hello world\n" );     printf( "hello world\n" );     printf( "hel...

if-else statement

Image
Table of Content Decision control Statement if-else statement if statement Nesting of if-else Dangling else problem else-if ladder If-else statement C uses the keyword if and else to implement the decision control statement. The general form of this statement look like this: Syntax:                       if(expression)                      statement1;                 else                      statement2; The expression inside the parenthesis is evaluated and  if it is true(Non-zero value), then state...

Control Statement

Image
 Control statements in C Control statements are executed sequentially in the order in which they appear in the program. But sometimes we may want to use a condition for executing only a part of program. Also many Situation arise where we may want to execute some statements several times. In other word , the control instruction determine the ' flow of control ' in  a program. There are different types of Control statement in C Language : Sequence Control statement  The Sequence Control statement ensures that the instructions are executed in the same order in which they appear in the program.  A group of statements enclosed within a pair of curly braces {}. The statements inside a block are executed Sequentially.  The general form is : statement1 statement2 ................. ................. For example : l = 4 ;  b = 2; area = l*b; printf("Area=%d", area); In the above example first declare the value of l and b after that find area = l*b then print. ...

Practice program of using an Operators.

Image
 Practice program 1. Write a  program that enters temperature in Celsius and converts that into Fahrenheit. solution : first you can write program in your IDE create a logic how to solve the problem  ※  convert temperature  Celsius  to Fahrenheit use  😊 Formula : ℉=( ℃ × 1.8) + 32 OR ℉=( ℃ × 9/5) +32 #include <stdio.h> int main() {     /*program to convert temperature Celsius to Fahrenheit*/     float C, F;     printf( "Input the Temperature in degree Celsius:" );     scanf( "%f" , &C);     F = (C * 9 / 5 ) + 32 ;     printf( "%.2f degree Celsius = %.2f degree Fahrenheit" , C, F);     return 0 ; } Output: Input the Temperature in degree Celsius:31.5 31.50 degree Celsius = 88.70 degree Fahrenheit 2. Write a program to accepts the radius of a circle and calculates the area and perimeter of that circle. solution : logic of that program : ※ accept the value of ra...