Monday 30 January 2017

C Language Structure Record Entry

NIELIT O Level Solved Paper
January 2016
C Language

Q8 b) Write a program to create a structure Employee having empCode, name, department, address and salary as its members. Read the details for 10 employees and then display them.

Solution : 

#include<stdio.h>
#include<conio.h>
struct stu
{
     int empcode;
     char name[20];
     char dept[20];
     char address[20];
     int sal;

};

Factorial number with recursion

NIELIT O Level Paper
C Language
 January 2016 Solved

Q8 a) Write a program having a recursive function to calculate the factorial of a number. In the main() function, read the value of the number and then using the recursive function display the result.

Solution :

/*   ################################
     Girfa Student Help
     Factorial recursion  program
     for more visit : http://girfahelp.blogspot.in/p/c-language.html
     ################################

Traffic Light Programe

NIELIT O Level January 2016 Solved

Q 7 : c) Write a program that displays the recommended actions depending on the color of a traffic light using the switch statement.

Solution : 

/* *******************************************
     Girfa : Student Help
     Traffic Light Program
     for more program visit : http://girfahelp.blogspot.in/p/c-language.html
     ********************************************/

Saturday 28 January 2017

Difference between while and do while

NIELIT O Level January 2016 Solve paper

Q 7 b.(ii) while and do..while loops

Iteration statements allow the set of instructions to execute repeatedly till the condition doesn’t turn out false. The Iteration statements in C for while loop and do while loop. These statements are commonly called loops. Here, the main difference between a while loop and do while loop is that while loop check condition before iteration of the loop, whereas do-while loop, checks the condition after the execution of the statements inside the loop.

BASIS FOR COMPARISON
WHILE
DO-WHILE
Syntax
while ( condition) {
statements; //body of loop
}
do{
.
statements; // body of loop.
.
} while( Condition );
Controlling Condition
In 'while' loop the controlling condition appears at the start of the loop.
In 'do-while' loop the controlling condition appears at the end of the loop.
Iterations
The iterations do not occur if, the condition at the first iteration, appears false.
The iteration occurs at least once even if the condition is false at the first iteration.