Skip to main content

Posts

Showing posts from September 1, 2018

String in C Programming Language

String in C Programming Language In this post, We will learn about string in C programming language. Introduction A string in C is merely an array of characters. The length of a string is determined by a terminating null character: '\0'. So, a string with the contents, say, "abc" has four characters: 'a', 'b', 'c', and the terminating null character. Initialize String in C Suppose you want to store Rozgardesh in String str you can do using one of below way 1. char str[] = "RozgarDesh"; 2. char str[50] = "RozgarDesh"; 3. char str[] = {'R','o','z','g','a','r','d','e','s','h','\0'}; 4. char str[11] = {'R','o','z','g','a','r','d','e','s','h','\0'}; Display String Here is an example to display the value of a string variable on th...

Comments in C Program

Comments in C Programming Language In this post, We will learn about comments in C programming language. We wirite comments in our to make it more readable on easily unstable.  A  comment never executed as part of the program means compiler ignore it. Type of Comment in C Single line Comment Multiline Comment Single line Comment Single line comments start with a double forward slash (//) // this is a single line comments compiler will ignore it Multiline Comment comments  In C programming multiline comments start with a forward slash and star (/*) and end with a star and forward slash(*/). /* this is a single line comments compiler will ignore it * Compiler will ignore it */ Example /* This is Hello world program * It will print Hello World on terminal */ #include <stdio.h> // including header file in program int main() // main function the program { printf("Hello World"); // printing Hello World on terminal return 0;...

Switch Statement in C Program

Switch Statement in C Program In this post, We will learn about switch case statement in the C programming language. The if..else..if ladder allows you to execute a block code among many alternatives. If you are checking on the value of a single variable in if...else...if, it is better to use a switch statement. Syntax Switch-Case in C switch (n) ​{ case constant1: // code to be executed if n is equal to constant1; break; case constant2: // code to be executed if n is equal to constant2; break; . . . default: // code to be executed if n doesn't match any constant } Example: Take a character input and find if the input is +, -, * or /.  # include <stdio.h> int main() { char operator; printf("Enter an operator (+, -, *, /): "); scanf("%c", &operator); switch(operator) { case '+': printf("+ Operator"); ...

Array In C Program

Array in C Programming Language In this post, We will learn about array in c programming language, particularly what is an array how to declare an array variable and how to access an element of an array in C. Array In C   We already have discussed variable, a variable stores a single value at a time. What if we need to store 100 or 1000 value, we can store 100 values by declaring 100 variables but practically it is not essay because in a real program we need to store more than billion value at a time. An array used to solve this problem, An array is a collection of data items, all of the same types, accessed using a common name. Declare Array in C In C program we declare an array same as a variable just at the end we mention the number of the element we want to store in the array. Syntax to declare an array data_type array_name[number_of_element]; Example: Declare an array that can store 10 integers. int my_integer_array[10]; Initialize a...

Break and Continue Statement in C

Break and Continue Statement in C In this post, We will learn about the break and continue statement in c programming language. Break Statement in C The break statement terminates the loop (for, while and do while loop) immediately when it is encountered. The break statement is used with decision-making statement such as if...else. Syntax Break break; Example:  write a program to calculate the sum numbers (maximum 10 numbers). Calculates sum until the user enters a positive number # include <stdio.h> int main() { int i; double number, sum = 0.0; for(i=1; i <= 10; ++i) { printf("Enter a n%d: ",i); scanf("%lf",&number); if(number < 0.0) { break; } sum += number; } printf("Sum = %.2lf",sum); return 0; } Continue Statement in C The continue statement skips some statements inside the loop. The continue statement is used with dec...

Function in C Program

Function in C Programming Language In this post,  We will learn about the function in c programming language. In C program a function is a block of code that does a specific task. Type of Function in C language There are two type of function in c programming language Standard library functions User-defined functions Standard library functions The standard library functions are built-in functions in C programming to handle tasks such as mathematical computations, I/O processing, string handling etc. these functions are defined in the header file, stdio.h is a header file, and scanf and printf function define in it. User-defined functions A user defines function is the functions that we define. C allows a programmer to define their own function these function called user define a function. Here we learn two basic concepts about function in c programming language. How to define a function in C How to call a function in C How to define a funct...

Loop In C Programming Language

Loop In C Programming Language Introduction In this post, we will learn about loops in c programming language. In C programming language, loops are used to execute a set of statements repeatedly until a particular condition is satisfied. Remember in our very first we wrote a program to print "Hello, World". Now suppose we want to repeat this for 1000 times, means we want to print Hello, World 1000 in a program. It is not practically possible to repeat printf("Hello, World"); 1000 times and because here statement print "Hello, World" is repeatable we can use a loop. Types of Loop in C programming language There are three types of loop in C programming language. For Loop While Loop Do While Loop For Loop in C These are the steps that we follow while using for loop in c It first evaluates the initialization code. Then it checks the condition expression. If it is true, it executes the for-loop body. Then it evaluates the increment/decreme...

Bharat Electronics Limited Recruitment

Bharat Electronics Limited Company Name         :  Bharat Electronics Limited Post Name                       :   Medical Officers State                            :  Maharashtra Salary                           :  Rs 600 per visit Number of Vacancy   : NA Eligibility                     :    B.A.M.S / B.H.M.S Last Date to Apply     :  04-09-2018 Application Details    :  Notification Apply Online              :  Apply Here Government Jobs In  Maharashtra Please write comments if you find anything incorrect, or you want to share m...

Bharat Electronics Limited

Bharat Electronics Limited Company Name         :  Bharat Electronics Limited Post Name                       :   Medical Officers State                            :   Andhra Pradesh Salary                           :  Rs 600 per visit Number of Vacancy   : 02 Eligibility                     :    B.A.M.S / B.H.M.S Last Date to Apply     :  01-10-2018 Application Details    :  Notification Apply Online              :  Apply Here Government Jobs In  Andhra Pradesh Please write comments if you find anything incorrect, or you wa...

Bharat Electronics Limited Recruitment 2018

Bharat Electronics Limited Company Name         :  Bharat Electronics Limited Post Name                       :   Diploma/Graduate Apprenticeship State                            :  Uttar Pradesh Salary                           :  Rs 11,110 Number of Vacancy   :  100 Eligibility                     :    Diploma/Graduate Last Date to Apply     :  03-09-2018 Application Details    :  Notification Apply Online              :  Apply Here Government Jobs In  Uttar Pradesh Please write comments if you find anything incorrect, or you...