## Oct 15, 2020

### How Can Be Good write correct coding in C programming and how can be start?

To start coding in C you need to start learning C programming first and most important thing is your interest should be in C programming.

## Oct 8, 2020

### C program to print 2 15 41 80 132 197 275 366 numbers series

Ex: Write a C program to print 2 15 41 80 132 197 275 366 numbers series. How to write a C program to print 2 15 41 80 132 197 275 366 numbers series. C program to print 2 15 41 80 132 197 275 366 numbers series.

Input from user:

Enter the number: 8

Expected output:

2 15 41 80 132 197 275 366

## Oct 7, 2020

### C Program to Print 1 3 8 15 27 50 92 Number Series

Ex: Write a C program to print 1 3 8 15 27 50 92 number series. How to write a C program to print 1 3 8 15 27 50 92 number series. C program to print 1 3 8 15 27 50 92 number series.

Input from user:
Enter the number: 8

Expected output:
1 3 8 15 27 50 92

### C Program to Print Natural Numbers Series

Ex: Write a C program to print natural number series. How to write a C program to print natural number series. C program to print natural number series.

Input from user:

Enter the number: 8

Expected output:

1 2 3 4 5 6 7 8...

### Step by Step logic of the given program:

1. Accept input number from user declare variable say no.

2.  Run for loop from 1 to no to print series from 1 to n:

3. Inside that loop print value of i.

## Program to print natural numbers series :

``````
#include<stdio.h>

void main()

{

int no;

int i;

printf("Enter the number:\n");

scanf("%d",&no);

/*Run loop from 1 to no*/

for(i=1;i<=no;i++)

{

/*Print value of i with one space*/

printf("%d ",i);

}

}

``````

Above program shows the following output:

### Series Programs in C Exercises and Solutions

In these post we will learn different mathematical series programs using C programming language.

In this exercises you will learn about series programs. How to print series programs in C programming language. Below is shown some series programming exercises and examples or practice set to solve it your self.

## Guess the number game Program in C:

In this tutorial we will learn how to create Guess the number game project in C.

In these program we used two extra header files one is <stdlib.h> and second is <time.h>. <stdlib.h> header file  used because,

## Rock-Paper-Scissor Game Project using C Language:

In this tutorial we will learn how to create Rock-Paper-Scissor game project using C language.

In these program we used two new header files one is <stdlib.h> and second is <time.h><stdlib.h> header file  used because

## Data Input and output functions in C:

The C programming language  supports many library functions which includes a number of input/output functions. These functions are used to transfer the information between the computer and device(user).

### Some basic input/output functions are:

• scanf() and printf(): These two functions are used to transfer the single characters, strings and numerical values.

• getchar() and putchar(): These two functions are used to transfer single characters.

• gets() and puts(): is used to input and output strings.

### 1. How to use scanf and printf functions:

scanf() function is used to take input from user(keyboard).

printf() function is used to display output on the screen.

### Example Program:

#include<stdio.h>

void main()

{

int num;// variable definition

/*Display message and ask user to enter some number... using printf()*/

printf("Enter the number:");

/*Read the number entered by user... using scanf()*/

scanf("%d",&num);

/*Display the number with message...using printf() */

printf("You entered number is:  %d",num);

}

In above program %d is used to scan the intiger value.

If value is char then we use %c.

If value is float then we use %f and so on...

Above program shows the following output:

### 2. How to use getchar and putchar functions in our program:

getchar() function reads  a single character from the terminal and returns it as an intiger.

putchar() function is used to display these single character.

Example program:

#include<stdio.h>

void main()

{

int a;

printf("Enter a character:");

/*Here, getchar function is used to store the accepted character in variable a*/

a = getchar();

/*Display the character stored in variable a using putchar function*/

putchar(a);

}

Above program shows the following output:

### 3. How to use gets() and puts() function in C:

In simple words:

gets() function is used to accept string from user.

puts() function is used to display the string.

### Example program:

#include<stdio.h>

void main()

{

//Declare character array to store string

char str[100];

printf("Enter a string: ");

/*store string in array str*/

gets(str);

/*Display string on the output screen*/

puts(str);

}

Above program shows the following output: