Skip to main content

Posts

Showing posts from May, 2020

C PROGRAM: Simple explanation of c program to find greatest of two number using conditional operator.

C Programming What is operators? What is conditional operator? How to find greatest of two number using conditional operator? We will be discussing about the c program to find greatest of two number using conditional operator and the other details. what is operator?    An operator is a symbolic, which performs particular manipulations or operations on data that is assigned to a variable. Following are the types of operator: Arithmetic operators        -   +,-,*,/,% Relational operators         -   <,>,==,<=,>=,!= Logical operator               -   &&,||,!= Increment or Decrement  -    ++,-- Assignment operator        -    = Bit wise operator             -     &,|,^,>>,<<,~ Comma operator          ...

C PROGRAM: Simple explanation of c program to find whether given number is even or odd using if-else statement.

C Programming What is even number? What is odd number? How to find  whether given number is even or odd using if-else statement? We will be discussing about the c program to find whether given number is even or odd  and the other details. what is Even number?   The number which are divided by 2 are all known as Even number. The last number of even number will always be 0,2,4,6 and  8.     example:                 24, 56,94...  What is odd number?   The number which are not divided by 2 are all known as odd number. The last number will always be 1,3,5,7 and 9.     example:                  23,89,243... C program to find whether given number is even or odd. Explaination : Header file  stdio.h  -  standard input and output to get input and show output,  conio.h  -  console input and output. void main -   function...

C PROGRAM: Simple explanation of c program to find leap year using if-else statement.

C Programming What is leap year? What is if statement? How to find the year is leap year are not using c program? We will be discussing about the c program to find leap year and the other details. what is leap year? The leap year is the year which has 366 days per year. It is said that leap is repeated every four year.                     formula:    year%4=0 What is if else statement? It is a condition statement. If the condition is true it executes the first statement,  if not (else) it will execute the second statement. syntax:            if(condition)                    {                       statement-1                      else                       statement-2   ...

C PROGRAM: Simple explanation of c program to reverse the given number.

C Programming We will be discussing about the c program to reverse a given number. C program to  reverse a given  number. Header file  stdio.h  -  standard input and output to get input and show output,  conio.h  -  console input and outpu t. void main -   function returning value will be null. int -  declare the type of variable. clrscr  - clear the screen. printf  - used to print the output screen. scanf  - used to accept input (%d), and read (&n). getch  - used to hold the screen until the user gives any type of input. \n  is used to print next statement in next line in output screen. I have used  while loop. logic behind the program while conditions : the given number n, should be greater then 1. if condition is true, it execute the follow statement,  a=n%10, the given number is divide bt 10 and the reminder is considered as answer. r=r*10+a; r is multiplied by 10 and added with the a. n=n/10; n...

C PROGRAM: Simple explanation of c program to swap two numbers.

C Programming We will be discussing about the c program to swap two numbers. But first we should know what is swapping? Swapping is the exchange of values in the variable.For example, variable 'a' is assigned with value '20' and 'b' variable with '90', after swapping the valve of a is 90 and b  is 20. I will explain the logic below after the program. C program to Swap 2 numbers. Explaination: Header file  stdio.h  -  standard input and output to get input and show output,  conio.h  -  console input and output. void main -   function returning value will be null. int -  declare the type of variable. clrscr  - clear the screen. printf  - used to print the output screen. scanf  - used to accept input (%d), and read (&a,&b). getch  - used to hold the screen until the user gives any type of input. Output: logic behind the program :  In the above program, a is assigned to the value 5(a=5), b is assigned to the ...

C PROGRAM: Simple explanation of c program to find the table of any number.

C Programming We will be discussing about the c program to find the table of any number. We all know that tables is the multiple of the numbers. C program to find the table of any number. Explaination: Header file  stdio.h  -  standard input and output to get input and show output,  conio.h  -  console input and outpu t. void main -   function returning value will be null. int -  declare the type of variable. clrscr  - clear the screen. printf  - used to print the output screen. scanf  - used to accept input (%d), and read (&n.&i.&k). getch  - used to hold the screen until the user gives any type of input. \n  is used to print next statement in next line in output screen. I have used while loop.        While loop: It is a loop control statement . It checks for the condition at the beginning, if condition is true, the loop is executed. if the condition is false, the next loop statement i...

C PROGRAM: Simple explanation of c program to convert Celsius to Fahrenheit and kelvin.

C Programming We will be discussing about the program to convert Celsius to Fahrenheit and kelvin. How can we convert it??... For that we should first know what are    Celsius, Fahrenheit and kelvin. And relation between them. Celsius(c), Fahrenheit(f) and kelvin(k) are the units of temperature. They are used to measure the temperature. Relation between them:      Celsius to kelvin:  k=c+273.     kelvin to Celsius:  c=k-273.     Celsius to Fahrenheit:  f=1.8*c + 32.      Fahrenheit  to Celsius:  c=(f-32)/1.8 .      Fahrenheit  to kelvin:  k=f + 457.87.      kelvin to  Fahrenheit :  f =k - 457.87. C program to convert Celsius to Fahrenheit and kelvin. Header file  stdio.h -  standard input and output to get input and show output,  conio.h -  console input and outpu t. void main -   function returning value will be n...

C PROGRAM: Simple explanation of c program to find simple interest and compound interest.

C Programming We will be discussing about the program to find Simple interest and Compounding interest. To write the program fist we should understand what is simple and compound interest? What is simple interest?                Simple interest is the amount which we get, when we initially  invest some money to some period of time and a small percent of initial money is add to the initial invested money. Given by the formula SI=(p*r*t)/100                          where, p is principle i.e initial amount                                      r is rate i.e some percent on initial amount                                      t is time i.e particular period What...

C PROGRAM: Simple explanation of c program to find area and perimeter of simple shapes.

C Programming We will be discussing about the program to find area, perimeter and circumstances of simple 2D shapes like square, rectangle, triangle and circle.  C program to find area and circumstances of a circle. #include<stdio.h> #include<conio.h> void main() {    int r;    float pi=3.14,area,ci;    clrscr();      printf("Enter radius of the circle:");    scanf("%d",&r);    area=pi*r*r;    printf("Area of circle=%f\n", area);      ci=2*pi*r;    printf("Circumference = %f\n, ci);    getch(); }  Output:       Enter radius of the circle: 2       Area of circle= 2.0000       Circumferences=12.5600 Explaination: Header file stdio.h -  standard input and output to get input and show output,  conio.h -  console input and output .   void main -   function returning value will be null...

How to learn c programming concept easily in simple and fast way?

 C Programming concept.   Anything in structured format is easy to understand.  C is a structured language. We can easily debug, test and maintain the program by learning the structure. Structure Of a C Program:                           Include header file section                       Global declaration section                       main()                         {                             Declaration part                             Executable part                         }                 ...