## Sum of N No. of NATURAL Number - C Programming Examples

Software Programming Coding and Tutorials for Electronics engineering students and graduates.Students projects for Engineering study materials.
We have started C Programming coding with Example Series, We have published in previous post about Fibonacci , Arithmetic , Geometric And Harmonic Series.Now we are going to Explore new segment about Special Series and Sequences.

We have chosen to start with Natural Numbers and in this post you will find some basic idea and some useful concepts about Natural Numbers .In this post we are writing a C program for Finding SUM of N Natural Numbers in TURBO C/C++ Application Software / Compiler .You can download C Codes below.Please let us know your feedback.

SUM OF N NATURAL NUMBERS Video Tutorial(See C- Codes Below ):

Natural Numbers Explained:-
In mathematics, the natural numbers are those used for counting (as in "there are six coins on the table") and ordering (as in "this is the third largest city in the country"). In common language, words used for counting are "cardinal numbers" and words used for ordering are "ordinal numbers".

The sum of the first n natural numbers, Sn, is:

Some authors and ISO 31-11 begin the natural numbers with 0, corresponding to the non-negative integers 0, 1, 2, 3, …, whereas others start with 1, corresponding to the positive integers 1, 2, 3, …

## Fibonacci Series Using Array And For Loop - C Programming Examples

Software Programming Coding and Tutorials for Electronics engineering students and graduates.Students projects for Engineering study materials.
As we have started C Programming coding with Example Series, We have published last posts

In this post we are doing again Fibonacci Series but with different approach.In last post "Fibonacci Progression Using While Loop" you will see how to generate Fibonacci Numbers by using concepts of  Do-While Loop.In this post we will talk about another loop i.e. For Loop and side by side Concept of Arrays will be discussed and demonstrated.

Fibonacci Series - Sequence ( Using Array And For Loop ) Video Tutorial(See C- Codes Below ):

For Loop Concept: FOR Loops are the most useful type. The syntax for a for loop is
for ( variable initialisation; condition; variable update ) {
Code to execute while the condition is true
}

A working Example of FOR Loop
Example:

#include <stdio.h>

int main()
{
int x;
/* The loop goes while x < 10, and x increases by one every loop*/
for ( x = 0; x < 10; x++ )
{
/* Keep in mind that the loop condition checks
the conditional statement before it loops again.*/
printf( "%d\n", x );
}
getchar();
}

Array Concept: Arrays may be defined as a kind of data structure that can store a fixed-size sequential collection of elements of the same type.An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.

Arrays are of two types:
A. One-dimensional arrays
B. Multidimensional arrays

## Fibonacci Numbers Series Progression Using While Loop - C Programming Examples

Software Programming Coding and Tutorials for Electronics engineering students and graduates.Students projects for Engineering study materials.
As we have started C Programming coding with Example Series, We have published last posts

Fibonacci Numbers Progression - Series - Sequence to Nth Term Step-wise Video Tutorial(See C- Codes Below ):

Fibonacci Sequence:-The Fibonacci Sequence is the series of numbers:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...The next number is found by adding up the two numbers before it.

The 2 is found by adding the two numbers before it (1+1).Similarly, the 3 is found by adding the two numbers before it (1+2),And the 5 is (2+3),and so on!

## Harmonic Progression-Write A Program To Find SUM of Infinite HP.- C Programming Examples

Software Programming Coding and Tutorials for Electronics engineering students and graduates.Students projects for Engineering study materials.
As we have started C Programming coding with Example Series, We have published last posts "Write A Program To Find SUM of AP" and "Write A Program To Find SUM of GP Sequence". We have chosen to start with mathematical series and in this post you will find some basic idea and some useful concepts about Harmonic Progression (H.P.).You can download C Codes below.Please let us know your feedback.

Common C Questions :TURBO C/C++
Integrated Environment : TURBO C/C++ - Getting Started
TURBO C/C++: Installer and Installation
C Language Programming With Examples-INDEX

Harmonic Progression/Sequence Step-wise Video Tutorial(See C- Codes Below ):

In mathematics, a Harmonic Progression (or harmonic sequence) is a progression formed by taking the reciprocals of an arithmetic progression. In other words, it is a sequence of the form.
where −a/d is not a natural number and k is a natural number.

Equivalently, a sequence is a harmonic progression when each term is the harmonic mean of the neighboring terms.It is not possible for a harmonic progression (other than the trivial case where a = 1 and k = 0) to sum to an integer. The reason is that, necessarily, at least one denominator of the progression will be divisible by a prime number that does not divide any other denominator.

A general H.P. is 1/a + 1/(a + d) + 1(a + 2d) + ...

nth term of an H.P. = 1/[a +(n -1)d]

## Geometric Progression - Write A Program To Find SUM of GP Sequence -C Programming Examples

Software Programming Coding and Tutorials for Electronics engineering students and graduates.Students projects for Engineering study materials.
As we have started C Programming coding with Example Series, We have published last post Write A Program To Find SUM of AP. We have chosen to start with mathematical series and in this post you will find some basic idea and some useful concepts about Geometric Progression (G.P.).You can download C Codes below.Please let us know your feedback.

Integrated Environment : TURBO C/C++ - Getting Started
TURBO C/C++: Installer and Installation
C Language Programming With Examples-INDEX

Arithmetic Progression Step-wise Video Tutorial(See C- Codes Below ):

Geometric Progression Basic Guide:-A sequence of non-zero numbers is a Geometric Progression (G.P.) if the ratio of any term and its preceding term is always constant.

A Geometric Progression (G.P.) is given by a, ar, ar2, ar3, ...
where a = the first term , r = the common ratio

Examples for Geometric Progressions
1, 3, 9, 27, ... is a geometric progression (G.P.) with a = 1 and r = 3

2, 4, 8, 16, ... is a geometric progression (G.P.) with a = 2 and r = 2

Nth term of a geometric progression (G.P.)

Sum of first N terms in a geometric progression (G.P.)

## Arithmetic Progression - Write A Program To Find SUM of AP C Programming Examples

Software Programming Coding and Tutorials for Electronics engineering students and graduates.Students projects for Engineering study materials.

We re starting C Programming Tutorial Series.We will try to satisfy our readers by giving some quality content in this series.

To Begin-with we have chosen to start with mathematical series.First series that always troubles students is Arithmetic progression.In this post you will find some basic idea and some useful concepts below.

Arithmetic Progression Step-wise Video Tutorial(See C- Codes Below ):

Integrated Environment : TURBO C/C++ - Getting Started
TURBO C/C++: Installer and Installation
C Programming Basic Questions
Variables-Pointer-Array-Files
Write A Program To Find SUM of Geometric Progression
Write A Program To Find SUM of Infinite Harmonic Progression

Arithmetic Progression / Sequence  Mathematically Explained:

Arithmetic progression (AP) is a sequence of numbers in which each term after the first is obtained by adding a constant, d to the preceding term. The constant d is called common difference.

An arithmetic progression is given by a, (a + d), (a + 2d), (a + 3d), ...
where a = the first term , d = the common difference

Sum of first N Terms of AP:

Nth term of an arithmetic progression Tn = a + (n – 1)d
(where Tn = nth term, a= the first term , d= common difference)

Number of terms of an arithmetic progression
n=(l−a)d+1
(where n = number of terms, a= the first term , l = last term, d= common difference)

## String To Float Data Type Conversion Using Microchip Controller PIC16F877A In Flowcode Programming Software

Software Programming Coding and Tutorials for Electronics engineering students and graduates.Students projects for Engineering study materials.
In previous post Float to String Conversion we have seen how to convert Float types of data in String type of Arrays using simple programming techniques.In this project we will be using FlowCode Software for writing a program to convert String Array or Array of Character to Floating type of Data using micro-controller of Microchip company PIC16 Family Micro controller PIC16F877A for testing and Simulation.This Project shows how we are outputting results values to LCD ( Liquid Crystal Display ).Varying the delay and write-erase sequence can be manipulated to different types of combination and lots of desired result.
Flow code program Snapshot(Above).

Here value used is of PI=3.1473

Command used is
string = FloatToString\$ (float)
float = StringToFloat\$ (string)

Recent Related Programs
Keypad and LED Interfacing With PIC16F88

Here is the complete list of projects:
Tutorials for Flow Code Programming and Simulation

FlowCode Simulation [How To Do] Video Tutorial:

A brief introduction to the concept of Data types and String Array:-

Data types in c refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.

## Float to String PIC16F88 FlowCode Microcontroller Programming And Simulation

Software Programming Coding and Tutorials for Electronics engineering students and graduates.Students projects for Engineering study materials.
In this sample project we are using Programming Software FlowCode for writing a program to convert Float Data to String Array using micro-controller of PIC16 Family PIC16F88 for testing and Simulation.Project shows how we are outputting results values to LCD ( Liquid Crystal Display ).Varying the delay and write-erase sequence can be manipulated to get desired result.
Above is the Flow code program Snapshot.

Recent Related Programs

Here is the complete list of projects:
Tutorials for Flow Code Programming and Simulation

Flow code Simulation and how to do Video Tutorial:

A brief introduction to the concept of Data types and String Array:-

Data types in c refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.Data Types in C can be classified as follows −(a) integer types and (b) floating-point types.

A. Integer Types: The following table provides the details of standard integer types with their storage sizes and value ranges(See Image above).

B. Floating-Point Types: The following table provide the details of standard floating-point types with storage sizes and value ranges and their precision(See Image above).

## LCD Interfacing With Keypad PIC16F877A FlowCode Microcontroller Programming And Simulation

Software Programming Coding and Tutorials for Electronics engineering students and graduates.Students projects for Engineering study materials.
In this sample project we are using Programming Software FlowCode for Programming LCD ( Liquid Crystal Display ) With Keypad and Testing And Interfacing with PIC16F877A.It shows how to use and simulate and program Keypad with LCD for use in different projects.In this Project we are testing Keypad and outputting binary values to LCD ( Liquid Crystal Display ).Varying the delay and write-erase sequence can be manipulated to get desired result.

Above is the Flow code program Snapshot:

Recent Related Programs
Keypad and LED Interfacing With PIC16F88

LCD(16x2) Display Related Programs

Voltage as Float(LCD with PIC16F1937)
Voltage as String (LCD with PIC16F1937)
ADC Sampling and outputting to a LCD
Number on 16x2 LCD Display with PIC16F88
Printing and Updating Number on 16x2 LCD Display
Two line(String) message (LCD 16x2)
Printing a formatted number on ( LCD 16x2 )

OutPut On LCD Dispaly And LED Strip is as Given.This data is Further Used for Interfacing in other big and complicated Projects
 Keypad LED Strip LCD(Liquid Crystal Display) 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 * 1010 10 # 1011 11

Flow code Simulation and how to do Video Tutorial:

LCD (Liquid Crystal Display 16X2):-

Its screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments and other multi segment LEDs.
The reasons being: LCDs are economical; easily programmable; have no limitation of displaying special & even custom characters (unlike in seven segments), animations and so on.

## Keypad and LED Interfacing With PIC16F88 FlowCode Programming And Simulation

Software Programming Coding and Tutorials for Electronics engineering students and graduates.Students projects for Engineering study materials.
In this sample project we are using FlowCode Simulation Software for Programming and Testing with PIC16F88.It shows how to use and simulate and program Keypad with LED for use in different projects.In this Project we are testing Keypad and outputting binary values to LED (Light Emitting Diodes ).Varying the delay and write-erase sequence can be manipulated to get desired result.

Above is the Flow code program:

Keypad Introduction:-The invention of the keypad is attributed to John E. Kerlin, an industrial psychologist at Bell Labs in Murray Hill.A computer keyboard usually has a small numeric keypad on the side, in addition to the other number keys on the top, but with a calculator-style arrangement of buttons that allow more efficient entry of numerical data.

This number pad (commonly abbreviated to "numpad") is usually positioned on the right side of the keyboard because most people are right-handed.

## PIC18F4455 ADC Sampling and Writing to SDCard FlowCode Simulation

Software Programming Coding and Tutorials for Electronics engineering students and graduates.Students projects for Engineering study materials.
In this project "ADC Sampling and Writing to SDCard" PIC series micro controller - PIC18F4455 has been used with Liquid Crystal Display (16X2) in Flowcode Simulation Software.As Source of ADC Metal POT (PotentioMeter ) has been used as the variables for desired results and final results are being written to SD Card FAT16 Type.

In this example we are using LCD to display the results of ADC calculation as seen in the examples code and videos.You can manipulate the POT while sampling is going on.As per concept of sampling POT should be kept at desired position to emulate it as sensor and then sampling needs to be done.

Here is the Flow code program:

ADC Related Sample Projects and Programming Codes
Here is the complete list of projects:

Tutorials for Flow Code Programming and Simulation

We are doing 10 Samples per cycle.In video you will be able to see step-wise execution of program and their effect on LCD in panel which is by default in the software .

Flow code Simulation and how to do Video Tutorial:

Little Introduction:An analog-to-digital converter (ADC, A/D, or A to D) is a device that converts a continuous physical quantity (usually voltage) to a digital number that represents the quantity's amplitude.The conversion involves quantization of the input, so it necessarily introduces a small amount of error. Instead of doing a single conversion, an ADC often performs the conversions ("samples" the input) periodically.

## Digital Clock On LCD (16x2) PIC16F1937 Used In FlowCode Programming and Simulation

Software Programming Coding and Tutorials for Electronics engineering students and graduates.Students projects for Engineering study materials.

In this sample project we are using FlowCode Simulation Software for Programming and Testing with PIC16F1937.It shows how to use and simulate and program LCD for use in different projects.In this Project we have created digital clock(Using two digit each for seconds minute and hours in 24 Hour format on LCD) on 16x2 Liquid Crystal Display.Varying the delay and write-erase sequence can be manipulated to get desired result.

Here is the Flow code program:

LCD(16x2) Display Related Programs

Printing a Two line(String) message (LCD 16x2)
Printing a formatted number on ( LCD 16x2 ) Using PIC16F88

LCD (Liquid Crystal Display 16X2):-
Its screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments and other multi segment LEDs.

LCD Complete Tutorials for beginners