Category Archives: C

Program to print a pattern of numbers

The idea of pattern based programs is to understand the concept of nesting of for loops and how and where to place the alphabets / numbers / stars to make the desired pattern. Write to program to print the pattern of numbers in the following manner using for loop 1 232 34543 4567654 567898765 In… Read More »



See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.

C program to simulate Nondeterministic Finite Automata (NFA)

Background An NFA is typically described using a directed graph. Each edge and vertex is labeled either 0 or 1 representing possible transitions. Vertices represent the states of the NFA. Those labeled 0 are non­ accepting states, and those labeled 1 are accepting states. It takes an input string of finite length. Typically, the input… Read More »



See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.

Type Conversion in C

A type cast is basically a conversion from one type to another. There are two types of type conversion: Implicit Type Conversion Also known as ‘automatic type conversion’. Done by the compiler on its own, without any external trigger from the user. Generally takes place when in an expression more than one data type is… Read More »



See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.
Category: C

Solving f(n)= (1) + (2*3) + (4*5*6) … n using Recursion

  Example: Input : 2 Output: 7 Series: (1) + (2*3) Input : 4 Output: 5167 Series: (1) + (2*3) + (4*5*6) + (7*8*9*10) We strongly recommend you to minimize your browser and try this yourself first   Output: 365527   Source : http://qa.geeksforgeeks.org/6597/wap-a-program-for-f-n-1-2-3-4-5-6-n-using-recursion/   Please write comments if you find anything incorrect, or you… Read More »



See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.

C Program to print numbers from 1 to N without using semicolon?

How to print numbers from 1 to N without using any semicolon in C. What code to add in above snippet such that it doesn’t contain semicolon and prints numbers from 1 to N? We strongly recommend you to minimize your browser and try this yourself first Method 1 (Recursive) Output: 1 2 3 4… Read More »



See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.
Category: C

What’s difference between char s[] and char *s in C?

Consider below two statements in C. What is difference between two? char s[] = “geeksquiz”; char *s = “geeksquiz”; The statements ‘char s[] = “geeksquiz”‘ creates a character array which is like any other array and we can do all array operations. The only special thing about this array is, although we have initialized it… Read More »



See Placement Course for placement preparation, GATE Corner for GATE CS Preparation and Quiz Corner for all Quizzes on GeeksQuiz.