Friday, 27 January 2017

Passing 2D Array to Function

NIELIT O Level January 2016

Q 6.c :  Write a function to read a two dimensional matrix along with the number of rows and columns in it, from the user. The contents of the array and the number of rows and columns should be passed back to the calling function.

Solution : 

/*   ************************************************
           Girfa : Student Help
           Passing Two dimentional array to a function
           for more program visit : http://girfahelp.blogspot.com/p/c-language-assignment.html
     *************************************************/
#include<stdio.h>
#include<conio.h>
#define ROW 10
#define COL 10
void print(int (*)[],int,int);
void main()
{
     int ar[ROW][COL],r,c,i;
     clrscr();
     for(r=0,i=1;r<ROW;r++)
     {
           for(c=0;c<COL;c++)
           {
                ar[r][c]=i;
                i++;
           }
     }
     printf("Enter Number of row and column to read>> ");
     scanf("%d%d",&r,&c);
     print(ar,r,c);

Thursday, 26 January 2017

Differentiate between if and switch case

NIELIT O Level January-2016

Q 6 B (i) :  Differentiate between  if and switch case

Solution : 
While programming, a number conditions come and a number of decisions need to be taken by a programmer. For decision making in C programming, the statements such as if, if..else, else if, switch case etc.
Though which when number of possible condition got increase in some scenario then if-else ladder implementation become complicated. So we can achieve this using switch case in simple manner with decreasing complexity.

Wednesday, 25 January 2017

function to print the series

NIELIT O Level
C Language Paper 
January-16
Question no: (6.b)

Write a function to print the sum of the following series:
                               1 + 22 + 33 + … + nn

Solution : 



/*   ################################
     Girfa Student Help
     Function for series printing
     for more visit : http://girfahelp.blogspot.in/p/c-language.html
     ################################
*/
#include<stdio.h>
#include<conio.h>
int sr(int);
void main()

Factorial Number Flow Chart

Draw a flowchart to print the factorials of numbers from 1 to n, where n is entered by user


Factorial Number Flow Chart