Control structures form the essential entities of a “structured programming language“. We all know languages like C/C++ or Java are all structured programming languages. Control structures are wont to alter the flow of execution of the program. Why can we got to alter the program flow ? the rationale is “decision making“! In life, we could also be given with a group of option like doing “Electronics” or “Computer science”. We do make a choice by analyzing certain conditions (like our personal interest, scope of job opportunities etc). With the choice we make, we alter the flow of our life’s…


Algorithm:

step 1:start

step 2:Declare i,n,fact

step 3:print “enter a number”

step 4:input n

step 5:initialize fact=1,i=1

step 6:if i>=n then goto step

step 7:i=i+1

step 8:goto step 6

step 9:print fact

step 10:stop

Flowchart

Code

#include <stdio.h>

int main() {

int fact=1;

int n;

printf(“Enter a Number:”);

scanf(“%d”,&n);

for(int i=1;i<=n;i++)

{

fact=fact*i;

}

printf(“Factorial of %d is %d”,n,fact);

}

Sample Input and Output:

Enter a Number:4

Factorial of 4 is 24

Explanation of above Program

Factorial:Factorial of a number is the product of all the integer from 1 to that number.for …


Identifier:

In C Programming,identifier is nothing but a user defined name given to variable,function,

structure etc.Identifier names must differ in spelling and case from any keywords.Let’s understand with an example:

float percentage=68.69;

int rollno=13;

In above eg We have defined two identifier percentage,rollno.

Rules for naming identifiers:

1.The first letter of an identifer should start either with letter or an underscore.

2.We cannot use Keyword as an identifer.

3.We can Use numerical value i.e 1–9 in identifier but it should start with either letter or underscore,We cannot define identifier starting with number.for …


In C Programming,Keywords are nothing but reserved word which has special meaning assigned to it. Keywords are also known as Reserved word.Keywords are part of the syntax and they cannot be used as an identifier.In C,We have total 32 Keywords.As C is Case Sensitive Language all the keywords must be defined in lower case.Let’s Understand Keyword With an example.

int rollno;

In above Eg we have declared one variable of type int.In …


Relation Operators

A relation operator is used for comparing two values it returns 1 if the relation is true and 0 if relation is false.For eg if you want to check that you are adult or not then we can se use comparison operator to check whether the entered age is greater than 17 or not ‘age>17’.

#include <stdio.h>

int main() {
int age=12;
if (age>17)
{
printf("You are adult");
}
else
{
printf("You are minor");
}
return 0;
}

Output

You are minor

Logical Operators


Operator

Operator is symbol that operates on a literal or variable.It can be used to perform mathematical calculation,logical manipulation,Comparison etc.It is used in program for manipulation of data and variable.There are different types of operator in C programming.

Arithmetic Operator

It is used for mathematical calculation like Addition,Multiplication,Division etc.We can Perform all these operation on either literal or variable.

1]+(Addition): This operator(+) is used to perform addition between numbers.

2]-(Subtraction): This operator(-) is used to perform subtraction between numbers.

3]*(Multiplication): This operator(*) is used to perform Multiplication between numbers .

4] /(Divison): This operator(/) is used to perform Division between…


  • Scope:Scope is a region in a program.It is nothing but a region where variable is declared and In that region it can be accessible.In C programming we have three different type of scope based on region where the variable is declared.
  • Types of Scope:

1.Local variable

local variable are defined inside function and it has local scope.local scope mean it is local to that function i.e it can be accessed within that function only.

#include <stdio.h>void funof()
{
/*local variable of function funof*/
int ew = 4;
printf("%d\n",ew);
}
int main()
{
/*local variable of function main*/…

Qualifier:It is used to modify the basic(primitive) data type in C.We can say that,this are the keyword which is used to modify the properties of variable.

Types of qualifiers In C:

1.Size Qualifier:Size Qualifier is used to change the size of the basic data type.By default the size of the integer data type is of 2 byte,In some cases we may require to increase or decrease the size of variable of type int or any other type In such case,we can use Size Qualifier.

  • Short:It reduces the size of the basic data type or keep the size as it is…

The following are the phases through which our program passes before being transformed into an executable form:

  • Preprocessor
  • Compiler
  • Assembler
  • Linker

Preprocessor

The source code is the code which is written in a text editor and the source code file is given an extension “.c”. This source code is first passed to the preprocessor, and then the preprocessor expands this code. After expanding the code, the expanded code is passed to the compiler.

Compiler

The code which is expanded by the preprocessor is passed to the compiler. The compiler converts this code into assembly code. …


  • Comment:In Programming,Comments are the statement which is used for explanation or annotation in the source code of a computer program.This statement are ignored by compiler and interpreter.The purpose of using Comment in program is explaining the code in normal language like English,it is also beneficial for programmers because after a certain time if programmer look at his code then it would be difficult to understand without comment hence,We use comment.
  • Types of Comment:

1.Single line comment:This is a Single line comment it is used to comment only one statement.//(2 forward slash) is used for single line comment.

Eg:

int b;//declaring…

Pankaj Jaiswal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store