SlideShare a Scribd company logo
1 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

APIIT SD INDIA
Module Code: CE00312-1
Module title: Introduction to C programming

Submitted by:
Prince Kumar
E-mail id: prince_karan640035@yahoo.com

Page 1 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

Acknowledgement

I would like to use this opportunity to thank all who lend their hand for completing our
project successfully.
First of all I would like to thank Almighty, who drove us through our project with his
blessing and providing us with enough support to make it a success.
I would then like to thank our project supervisor Miss XYZ who was there to guide us along
the project, providing us assistance in doing the things in a proper and appropriate manner.
Without her supervision this project would have been a tedious task for us.
Also I would like to extend our gratitude to my friends, lab assistants, the librarian and
management for providing us with good services and creating an environment for carrying
out our project.
At last I am thankful to APIIT SD INDIA for giving me this opportunity to carry out my C
Assignment which contributed in enhancing my skill and knowledge in C Language.

Page 2 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

Contents
Acknowledgement .........................................................................................................................................2
1. Introduction...............................................................................................................................................4
1.1

Objective .......................................................................................................................................4

2. Project Description ...................................................................................................................................4
3. Program Design using Pseudo-code ........................................................................................................8
4. Segment of Code......................................................................................................................................11
4.1 Create Pattern ...................................................................................................................................14
4.1.1 Pyramid of asterisks ..................................................................................................................14
4.1.2 Pyramid of numbers ..................................................................................................................14
4.1.3 Square of asterisks .....................................................................................................................15
4.2 Print Series ........................................................................................................................................15
4.2.1 Series of Armstrong numbers between 1 and 500. ..................................................................15
4.2.2 Fibonacci series from 1 to 100 using recursion. ......................................................................16
4.2.3 Series of prime numbers from 1 to 100. ...................................................................................16
4.3 Work with Records ...........................................................................................................................17
4.3.1 Enter and Display Employee Information ...............................................................................17
4.3.2 Find Grade for a student ...........................................................................................................17
4.4 Use Numeric Functions.....................................................................................................................18
4.4.1 Factorial of a number using while loop ....................................................................................18
4.4.2 Sum of first and fifth digit of a 5 digit number. ......................................................................19
4.4.3 Find out whether a 5 digit number is palindrome or not. ......................................................19
4.5

Work with Arrays ......................................................................................................................20

4.5.1

Count number of vowels in the sentence. .............................................................................20

4.5.2

Copy the contents of an array into another. ........................................................................21

4.5.3

Delete item from an array .....................................................................................................21

4.6

Exit ..............................................................................................................................................22

5. User guide with Sample Input Output Screens ....................................................................................22
6. Limitations and Future Enhancements.................................................................................................27
7. Test Plan AND RESULT ...........................................................................................................................27
8. Conclusion ...............................................................................................................................................30
9. References ................................................................................................................................................31
10. Appendix ................................................................................................................................................32

Page 3 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

1. Introduction
C is a programming language developed at USA in 1972 by DENNIS RITCHIE. After that
time the popularity of C is gone on increasing without any advertisement.
C is a successor of B language which was introduced around 1970
The language was formalized in 1988 by the American National Standard Institute
(ANSI).
By 1973 UNIX OS almost totally written in C.
Today C is the most widely used System Programming Language.
Most of the state of the art software have been implemented using C. C was
invented to write an operating system called UNIX.

1.1 Objective
Be able to design, implement and document in well-organized manner.
Explain the structure, functions, array and correct use of many features and
implementation in appropriate advance manner to make application attractive.

2. Project Description
In our Program, there is optimized programming which contributes to the programs in menu
driven. The functionality of our program would be in the order of 1, 2, 3,4,5, and 6 in menu
driven. There are six option in main menuCreate Pattern,Print Series, Work with Records,
Use Numeric Functions, Work with Arrays and Exit.
Each case contains another switch functionality to perform following function:I.

Create Pattern

After selecting this option, menu will be provided for the following sub options:
1. Pyramid of asterisks
2. Pyramid of numbers
3. Square of asterisks
User will enter the sub-option and based upon it the following steps will execute
Pyramid of asterisks
System will ask for the number of rows of pattern from the user and will display the pattern
accordingly.
Like:
If he entered 6 then the output is:
*
**
***
Page 4 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

****
*****
******
Pyramid of numbers
System will ask for the number of rows of pattern from the user and will display the pattern
accordingly.
Like:
If he entered 6 then the output will be:
654321
65432
6543
654
65
6
Square of asterisks
System will ask for the number of rows of pattern from the user and will display the pattern
accordingly
Like:
If he entered 6 then the output will be:
******
******
******
******
******
******
II.

Print Series

After selecting this option, menu will be provided for the following sub options.
1. Series of Armstrong numbers between 1 and 500.
2. Fibonacci series from 1 to 100 using recursion.
3. Series of prime numbers from 1 to 100.
User will be asked to choose the sub-option and based upon that the result will be displayed
on the screen.

Page 5 of 44
Introduction to C ProgrammingCE00312-1

III.

Individual Assignment

Work with Records

After selecting this option, menu will be provided for the following sub options.
1. Enter and Display Employee Information
2. Find Grade for a student
User will be asked to choose the sub-option and based upon that the following steps should
execute:
Enter and Display Employee Information
In this option, array of structures should be used to hold employee information like employee
code, name etc. User will enter the information of three employees and after that system will
display the information of all the three employees on the screen.
Like:
If he entered Employee code: 1, Employee Name: XYZ and Department: HR Then the output
will be
Employee Code: 1
Employee Name: Xyz
Department: HR
Find Grade for a student
In this option, system will accept roll number, name and total marks of a student and will
display roll number, name and grade. A criteria for finding the grade is as follows:
If Marks >=70 grade is A
If Marks between 60 and 69 grade is B
If Marks between 50 and 59 grade is C
If Marks <50 grade is D
Like:
If he entered 80 then the output will be A
If he entered 65 then the output will be B
If he entered 55 then the output will be C
If he entered 40 then the output will be D

IV. Use Numeric Functions
After selecting this option, menu will be provided for the following sub options.
1. Factorial of a number using while loop
2. Sum of first and fifth digit of a 5 digit number.
3. Find out whether a 5 digit number is palindrome or not.
After selecting the sub-option, user will be asked to enter the appropriate number and the
calculations will be performed accordingly.
Factorial of a number using while loop.

Page 6 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

It will take number from the user and display the factorial of number.
Like
If user entered 4 then the factorial is 24 it will calculate like this 4*3*2*1
Sum of first and fifth digit of a 5 digit number.
It will take input from the user and it will sum of first and fifth digit number.
Like
If user entered 12345 then it will take first and fifth digit and the answer is 6.
Find out whether a 5 digit number is palindrome or not.
Like
If user entered 12321 then it will show 12321 is palindrome and if user entered 12345 then it
will show the entered number is not palindrome.
V.

Work with Arrays

After selecting this option, menu will be provided for the following sub options.
1. Count number of vowels in the sentence.
2. Copy the contents of an array into another.
3. Delete item from an array
After selecting the sub-option, user will be asked to enter the size of the array for the option 2
And 3, after that appropriate array will be entered and result will be displayed accordingly.
Maximum size of the array will be 100.
Count number of vowels in the sentence.
It will count vowels from the sentence and display number of vowels and constants distinctly
This will count the vowels in sentence
Like
If user entered “working” then it will show
Number of vowels in working = 2
Number of constant in working = 5
Copy the contents of an array into another.
If user entered 3 then it will take 3 input and display in one array.
Like
If user entered
Enter the value of array 1 = 1
Enter the value of array 2 = 2
Enter the value of array 3 = 3
Then
Page 7 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

It will show
Destination array = 3 2 1.
Delete item from an array
This will delete item from taken element
Like
It will take number of input number like if user entered 5 then user has to entered 5 input
1
2
3
4
5
Then it will ask to delete the item from array. If user entered 3 then it will show
1
2
4
5
VI.

Exit

This option is used to exit from the system

3. Program Design using Pseudo-code
3.1 Create Pattern
3.1.1 Pyramid of asterisks
Step1: START
Step2: Function Asterisk
Step3: Read n,c,k
Step4: Display
Step5: Input n
Step6: Loop C from 1 to x.
End Loop
Step7: Display *
Step8: STOP
3.1.2 Pyramid of numbers
Step1: START
Step2: Function Pyramid Numbers
Step3: Read num,r,c
Step4: Display
Step5: Input num
Step6: Loop R from num to r.
End Loop
Page 8 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

Step7: Display c
Step8: STOP
3.1.3 Square of asterisks
Step1: START
Step2: Function square_asterisk
Step3: Read num,r,c
Step4: Display
Step5: Input num
Step6: Loop C from 1 to x.
End Loop
Step7: Display *
Step8: STOP
3.2 Print Series
3.2.1 Series of Armstrong numbers between 1 and 500.
Step1: START
Step2: Function Armstrong
Step3: Read i,j,k,l,m,n;
Step4: Loop 1 from 1 to 500.
j=i%10;
k=i/10;
l=k%10;
m=k/10;
n=(m*m*m)+(l*l*l)+(j*j*j);
if (n==i)
End Loop
Step5: Display i
Step6: STOP
3.2.2 Fibonacci series from 1 to 100 using recursion.
Step1: START
Step2: Function Fibonacci
Step3: Read old_number, current_number, next_number
Step4: Display
Step5: While (current_number < 100)
Step6: Display
Step7: STOP
3.2.3 Series of prime numbers from 1 to 100.
Step1: START
Step2: Function Prime
Step3: Read n,div,p, num=100
Step4: FOR LOOP N from 2 to num
:for(n=2; n<=num; n++)
:{
:for(div=2; div<n; div++)
:{
:if(n%div==0)
:{
:p=0;
:break;
:}
Page 9 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

:p=1;
:}
:if(p)
: END LOOP
Step5: Display n
Step6: STOP
3.3 Work with Records
3.3.1 Enter and Display Employee Information
Step1: START
Step2: Function emp_information
Step3: Read i=1,j=1
name[50],dept[20]
Step4: FOR LOOP I from 1 to 3
END LOOP
Step5: Display i and employee code
Step6: Read empCode
Step7: STOP
4.3.2 Find Grade for a student
Step1: START
Step2: Function grade_student
Step3: Read name[50], roll, marks
Step4: Display
Step5:Input
Step6: Display
Step7: Input
Step8: Display
Step9: Display
IF
Step10: Display
ELSE IF
Step11:Display
ELSE IF
Step12: Display
ELSE IF
Step13: Display
ELSE
Step14: Display
Step15: STOP
3.4 Use Numeric Functions
3.4.1 Factorial of a number using while loop
Step1: START
Step2: Function factorial
Step3: Read a,i
Step4: Display
Step5: Input a
Step6: IF
: Display
: ELSE
Page 10 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

{
f=1;
i=1;
while(i<=a)
{
f = f * i;
i++;
}
Step7: Display
Stop8: STOP

4. Segment of Code and Concepts
Concepts
Various C programming concepts have been applied in the program to make it as requested
by the project. We have included the wide variety of the c data handling techniques and
control structures to construct the whole program. Following are the concepts used in the
assignment and their elaboration with the sample code from the program.
Decision Control Structure:
There are three ways for taking decision in the program and they are –
IF-ELSE statement:
If else statement has been frequently used in the program to facilitate the user to make the
selection between the conditions based on the choice made. The sample code is shown below:
if (decimal_number1 >= decimal_number2)
{
flag = 0;
decimal_number3 = decimal_number1 – decimal_number2;
}
else
{
flag = 1;
decimal_number3 = decimal_number2 – decimal_number1;
}
Switch statement:
The developers have included many switch statements in the program whenever there is the
necessity to make the choices between multiple options. The main benefit of using switch
statement is that it will not take the control to scan each statement and execute the correct one
but the control will directly jump to the provided case.
Switch (temp_number[i])
{
case‘0’: number = number*10 + 0; break;

Page 11 of 44
Introduction to C ProgrammingCE00312-1
case‘1’:
case‘2’:
case‘3’:
case‘4’:
case‘5’:
case‘6’:
case‘7’:
case‘8’:
case‘9’:

number
number
number
number
number
number
number
number
number

=
=
=
=
=
=
=
=
=

Individual Assignment

number*10
number*10
number*10
number*10
number*10
number*10
number*10
number*10
number*10

+
+
+
+
+
+
+
+
+

1;
2;
3;
4;
5;
6;
7;
8;
9;

break;
break;
break;
break;
break;
break;
break;
break;
break;

}

Nested IF-ELSE
We have also included the nested if else statements whenever felt necessary. The sample
code is given below.
if (ch == 49 ||ch == 48)
{
printf("%c",ch);
temp_number[i] = ch;
i++;
}
elseif((ch == 8) && (i != 0))
{
printf("b");
printf(" ");
printf("b");
if (i!=0)
{
i--;
}
continue;
}

Loop Control Structure –
Looping constructs are used in assignments where the multiple iterations were to be used for
taking the passwords, calculating the totals, searching etc.
Following are the sample codes for the different types of looping constructs used in the
program.
For Looping structure:
for(i = node.char_count; node.temp_string[i] != '0'; i++)
{
printf("%c",node.temp_string[i]);

}
While Looping structure:
while(i!=20)
{
ch = getch();
if (ch == 13)
{
break;
}

Page 12 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

if (ch == 8)
{
if (i!=0)
{
printf("b");
printf(" ");
printf("b");
i--;
}
}
else
{
printf("%c",ch);
first_string[i] = ch;
i++;
}

Symbolic Constants
Symbolic constants are used in the program to make the program scalable. The length of
string array are defined at the very beginning of the program.
#define SIZE 20

Functions and pointers:
The whole program consists of many of the functions calling each other to perform the task
such as calculating determinant etc. Pointers are also used to pass through functions to
change the original values of in the memory location.
Example of function calling with Arguments:
int determinent_solution(int **a,int order)
{
int **temp,i, j, k = 0, b = 0, deter = 0, coloumn_position,
minor_value = 0;
temp = malloc((5) * sizeof(int *));
for(i = 0; i < 5; i++)
{
temp[i] = malloc(5 * sizeof(int *));
}

Arrays
Arrays are used to store the numeric data or the characters. Character arrays in the form of
string are used to store the information. The different numeric data after the calculation are
also stored in the array:
Examples of arrays in program (character arrays included)
void matrix_addition() // Array to store elements of matrices
{
int first_matrix[6][6], second_matrix[6][6],
result_matrix[6][6],row[2],coloumn[2],count = 0,i,j;

Page 13 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

Structures
Structures are used to store the string and a integer variable used in case of finding the
number of characters in string. Structures are initialized outside the main function to make it
global and the members of structures are accessed in the program wherever necessary.
Sample code for structure
struct search_char{
char temp_string[SIZE];
int char_count;
}node;

4.1 Create Pattern
4.1.1 Pyramid of asterisks
void asterisk()
{
Initialization of variables

int n, c, k;
printf("Enter number of rowsn");
scanf("%d",&n);

Performed

for ( c = 1 ; c <= n ; c++ )

Pyramid of asterisks

{
for( k = 1 ; k <= c ; k++ )
printf("*");
printf("n");
}
}
4.1.2 Pyramid of numbers
voidpyramid_numbers()
{
intnum,r,c;
printf("Enter any number: ");
scanf("%d", &num);
for(r=1; r<=num; r++)
{
for(c=num; c>=r; c--)
printf("%d",c);
printf("n");
}
}

Initialization of variables

Performed
Pyramid of Numbers

Page 14 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

4.1.3 Square of asterisks
voidsquare_asterisk()
{
Initialization of variables

intnum,r,c;
printf("Enter loop repeat number(rows): ");
scanf("%d",&num);
for(r=1; num>=r; r++)
{

Performed

for(c=1; c<=num; c++)

Square of asterisks

printf("*");
printf("n");
}
}
4.2 Print Series
4.2.1 Series of Armstrong numbers between 1 and 500.
void Armstrong()
{

Initialization of variables

inti,j,k,l,m,n;
for (i=1;i<=500;i++)
{
j=i%10;
k=i/10;

Performed

l=k%10;

Series of Armstrong
numbers between 1 and
500

m=k/10;
n=(m*m*m)+(l*l*l)+(j*j*j);
if (n==i)
printf("%d n",i);
}
}

Page 15 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

4.2.2 Fibonacci series from 1 to 100 using recursion.
void Fibonacci()
{
intold_number;
intcurrent_number;
intnext_number;

Initialization of variables

old_number = 1;
current_number = 1;
printf("1n");
while (current_number< 100) {
printf("%dn", current_number);
next_number = current_number + old_number;
old_number = current_number;

Performed
Fibonacci series from 1
to 100 using recursion.

current_number = next_number;
}
}
4.2.3 Series of prime numbers from 1 to 100.
void prime()
{
intn,div,p;
intnum=100;
for(n=2; n<=num; n++)
{
for(div=2; div<n; div++)

Performed

{

Series of prime numbers
from 1 to 100.

if(n%div==0)
{
p=0;
break;
}
p=1;
}
if(p)
printf("t%d",n);
Page 16 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

}
}
4.3 Work with Records
4.3.1 Enter and Display Employee Information
voidemp_information()
{
struct Emp e[3];
Initialization of variables

inti=1,j=1;
char name[50],dept[20];
for(i=1;i<=3;++i)
{
printf("nn Employee : %d", i);
printf("n Enter the Employee Code : ");
scanf("%d",&e[i].empCode);
printf("Enter the Employee Name : ");
scanf("%s",&name);
strcpy(e[i].empName,name);
printf("Enter the Department

: ");

scanf("%s",&dept);

Performed

strcpy(e[i].empDept,dept);

Enter and Display
Employee Information

}
printf("nnn Employee Details ");
for(j=1;j<=3;++j)
{
printf("nn Employee : %d",j);
printf("n Employee Code : %d",e[j].empCode);
printf("n Employee Name : %s",e[j].empName);
printf("n Department

: %s",e[j].empDept);

}
}
4.3.2 Find Grade for a student
voidgrade_student()
{
Page 17 of 44
Introduction to C ProgrammingCE00312-1

char name[50];

Individual Assignment

Initialization of variables

introll,marks;
printf("Enter student name:-- ");
scanf("%s",&name);
printf("Enter roll number of student:-- ");
scanf("%d",&roll);
printf("Enter total marks of student:-- ");
scanf("%d",&marks);
printf("nName of student is:-- %s",name);
printf("nRoll number is:-- %d",roll);
if(marks>=70)
printf("nYour Grade is A");
else if(marks>=60 && marks<=69)
printf("nYour Grade is B");

Performed

else if(marks>=50 && marks<=59)

Find Grade for a
student

printf("nYour Grade is C");
else if(marks<50)
printf("nYour Grade is D");
else
printf("n Kindly enter a valid marks");
}
4.4 Use Numeric Functions
4.4.1 Factorial of a number using while loop
void factorial()
{
unsigned long longint f;
inta,i;
printf("nEnter a number: ");
scanf("%d",&a);
if(a<0)
{
printf("nPlease enter a positive number");
Page 18 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

factorial();
}
Performed

else

Find Grade for a
student

{
f=1;
i=1;
while(i<=a)
{
f = f * i;
i++;
}
printf("Factorial: %lu",f);
}
}
4.4.2 Sum of first and fifth digit of a 5 digit number.
voidsum_of_first_to_fifth()
{
int number, last_digit, first_digit, total;

Initialization of variables

printf (" Enter a five digit numeber: ");
scanf ("%d", &number);
last_digit = number % 10;

Performed

total = last_digit;

Sum of first and fifth
digit of a 5 digit number

first_digit = (number / 10000) % 10;
total = total + first_digit;

printf ("The total of the first and the last digit of the entered number is: %d", total);
}
4.4.3 Find out whether a 5 digit number is palindrome or not.
voidpalindrom()
{
intnum,rem,i,rev=0,num1,count=0;
printf("Enter the five digit number:n");
scanf("%d",&num);
num1=num;
while(num>0)

Initialization of variables

Page 19 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

{
rem=num%10;
rev=rem+rev*10;
num=num/10;
count++;
}
if(count==5)
{
if(num1==rev)
{
printf("The Given Number %d is Palindrome",num1);
}
else
{
printf("The Given Number %d is NOT Palindrome",num1);
}
}
else
{
printf("The given %d number is not a five digit number!",num1);
}

Performed
Find out whether a 5
digit number is
palindrome or not.

}
4.5 Work with Arrays
4.5.1 Count number of vowels in the sentence.
voidcount_vowel()
{
char sentence[80];
inti, vowels = 0, consonants = 0, special = 0;
printf("Enter a word n");
scanf("%s",&sentence);
for (i = 0; sentence[i] != '0'; i++)
{
if ((sentence[i] == 'a' || sentence[i] == 'e' || sentence[i] ==
'i' || sentence[i] == 'o' || sentence[i] == 'u') ||
(sentence[i] == 'A' || sentence[i] == 'E' || sentence[i] ==
'I' || sentence[i] == 'O' || sentence[i] == 'U'))
{
vowels = vowels + 1;
}
else
{
consonants = consonants + 1;
}
if (sentence[i] =='t' ||sentence[i] =='0' || sentence[i] ==' ')
{
Page 20 of 44

Performed
Count number of vowels
in the sentence
Introduction to C ProgrammingCE00312-1

Individual Assignment

special = special + 1;
}
}
consonants = consonants - special;
printf("No. of vowels in %s = %dn", sentence, vowels);
printf("No. of consonants in %s = %dn", sentence, consonants);
getch();
}
4.5.2 Copy the contents of an array into another.
voidcopy_array()
{
int source[100], dest[100],i,j,no;

Initialization of variables

clrscr();
printf("Enter the number of values to be enterd: ");
scanf("%d",&no);
for(i=0;i<no;i++){
printf("Enter the value of array no. %d :",i+1);
scanf("%d",&source[i]);
}
Performed

for(i=0,j=no-1;i<no;i++,j--){

Copy the contents of an
array into another

dest[j]=source[i];
}
printf("Destination array:n");
for(i=0;i<no;i++){
printf("%dt",dest[i]);
}
}
4.5.3 Delete item from an array
voiddelete_array()
{
int array[100], position, c, n;

Initialization of variables

printf("Enter number of elements in arrayn");
scanf("%d", &n);
printf("Enter %d elementsn", n);
for ( c = 0 ; c < n ; c++ )
scanf("%d", &array[c]);
Page 21 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

printf("Enter the location where you wish to delete elementn");
scanf("%d", &position);
if ( position >= n+1 )
printf("Deletion not possible.n");
else
{
for ( c = position - 1 ; c < n - 1 ; c++ )
array[c] = array[c+1];

Performed
Delete item from an
array

printf("Resultant array isn");
for( c = 0 ; c < n - 1 ; c++ )
printf("%dn", array[c]);
}
}
4.6 Exit
exit (0);

5. User guide with Sample Input Output Screens

Page 22 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

Page 23 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

Page 24 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

Page 25 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

Page 26 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

6. Limitations and Future Enhancements
Like there are two faces of a coin so do our project has some of the limitation which makes it
non-functional in some cases. Following are some of the limitations of the program and
future enhancement –
I.

No graphical user interface -

The program does not provide any kind of graphical user interface as it is a console
application which may make it difficult to navigate for the user with little knowledge of
computers. It may also take lots of time for the user to use the program as the user has to go
through each and every message and texts written in the program unlike the graphical system
which provides the graphical images in replace of bulk text messages.
For the further enhancement the program can be made by choosing the windows
application format which provides the graphical user interface to the users making it easy to
navigate.
II.

No option to save results -

There is no way to store the results for future use and access them whenever required. Once
the work is done the results will be flushed out and system will come back to its previous
position.
For the further enhancement the program can make a use of file handling so that
results would be stored for future access.

7. Test PlanAND RESULT
In general, testing is finding out how well something works. In terms of human beings,
testing tells what level of knowledge or skill has been acquired. In computer hardware and
software development, testing is used at key checkpoints in the overall process to determine
whether objectives are being met. For example, in software development, product objectives
are sometimes tested by product user representatives. When the design is complete, coding
follows and the finished code is then tested at the unit PERFORMANCE MANAGEMENT
or module level by each programmer; at the component level by the group of programmers
involved; and at the system level when all components are combined together. At early or late
stages, a product or service may also be tested for usability.
At the system level, the manufacturer or independent reviewer may subject a product or
service to one or more performance tests, possibly using one or more benchmarks. Whether
viewed as a product or a service or both, an application can also be tested in various ways by observing user experiences, by asking questions of users, by timing the flow through
specific usage scenarios, and by comparing it with other application.

Page 27 of 44
Introduction to C ProgrammingCE00312-1

Question No:

1.Pyramid of
asterisks

Individual Assignment

Input

6

2.Pyramid
numbers

of

of

*
**
***
****
*****
******

6

3. Square
asterisks

Output

6

Status

Tested
By:

Successful

654321
65432
6543
654
65
6
******
******
******
******
******
******

User

Successful

User

Successful

User

4. Series of
Armstrong
numbers
between 1 and
500

1
153
370
371
407

Successful

User

5.Fibonacci
series from 1 to
100
using
recursion

User

6. Series of
prime numbers
from 1 to 100.

1
Successful
1
2
3
5
8
13
21
34
55
89
2,3,5,7,11,13,17,19,23,
Successful
29,31,37,41,43,47,53,59,
61,67,71,73,79,83,89,97.

Enter and
Display
Employee
Information

Employee 1
Employee code:101
Employee Name: ABC
Department: HR

Successful

User

7.

Employee 2
Page 28 of 44

User
Introduction to C ProgrammingCE00312-1

Individual Assignment

Employee code:102
Employee Name: XYZ
Department: IT

9.Factorial of a
number
using
while loop

4

Employee 3
Employee code:103
Employee Name: DEF
Department: Accountant
Student name: ABC
Student number:12
Student marks:80
Grade: “A”
24

10.Sum of first
and fifth digit of
a 5 digit number

12345

11. Find out
whether a 5 digit
number
is
palindrome or
not

8. Find Grade
for a student

Successful

User

Successful

User

6

Successful

User

12321

Number is palindrome

Successful

User

12.Count
number
of
vowels in the
sentence

Working

Number of vowels in
“working”=2

Successful

User

13. Copy the
contents of an
array
into
another

Enter the
value of
array1=1

Destination array = 3 2 1

Successful

User

Item to be deleted from
array = 3
1

Successful

User

Number of constants in
“working”=5

Enter the
value of
array2=2
Enter the
value of
array3=3
14. Delete item
from an array

1
2
3

Page 29 of 44
Introduction to C ProgrammingCE00312-1

4
5
15. Exit

6

Individual Assignment

2
4
5
Exit – Out of the system

Successful

User

8. Conclusion
I started this project when I had very few concepts about the C language and its different
usage. During the project preparation Iwas introduced with the new concepts and new
elements of C language along with the progression of the course. I was able to apply all those
theoretical C concepts taught to me in my application to make it more and more functional.
As the time passed by I worked on my project to make it very Compaq and very much
functional and easy to use for the user. During this period I learned various C programming
concepts and now in position to design in the error free program successfully.
I came to know the various C programming techniques. I learned to make the variables and
constants either global or local.I also learned the practical way of implementing the structures
in the program and access the members of structures, compare them, initialize them and so
on. The implementation of techniques like string comparison, function calling, recursion,
array storage, and calling by value or reference, has broaden my knowledge regarding C
language.
The major technical learning I had from the project is that how different functions can be
associated to form the single program and how the data flows from one unit (function) to
another and produce the desired output. I was introduced with the validations techniques to
make the program error free and reliable. Ihad also learned to design the problem, develop
the algorithms, and test the program to measure the efficiency and accuracy.

Page 30 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

9. References
Books
I.

II.
III.
IV.
V.

Robert"C Programming Functions." C Programming Functions. Programiz, n.d. Web.
09 Nov. 2013.
Code Coding. "C Program to Print Pyramid." Cprogramtocom. WordPress.,n.d. Web.
09 Nov. 2013.
AbhasTandon. "C Program to Print All Prime Numbers between 1 and 100." - C
WithAbhas. Cwithabhas, n.d. Web. 09 Nov. 2013.
Dietel, P. & Dietel H. (2010).C How to program, New Delhi, Prentice Hall of India
(PHI). Vol 6, pp.1-437
Donald, K. (2001).The Art of Computer Programming, Kansas City, AddisonWesleyPublication vol. 1.

Electronic
I.

Available at :
http://www.cembedded.com/2009/04/write-pseudocode-to-compare-versions.html
[Last Accessed: 12 September 2013]

II.

Available at :
http://www.dreamincode.net/forums/topic/10300-pseudocode-help/
[Last Accessed: 1 October 2013]

III.

Available at :
http://www.fredosaurus.com/notes-cpp/algorithms/sorting/bubblesort-fixed.html [Last
Accessed: 15 September 2013]

IV.

Available at
http://www.metalshell.com/source_code/32/Simple_Struct_Example.html
[Last Accessed: 19 September 2013]

V.

Available at
http://qa.techinterviews.com/q/20060729010733AA7wpXo
[Last Accessed: 25 September 2013]

VI.

Available at
http://www.unf.edu/~broggio/cop3530/3530pseu.htm
[Last Accessed: 21 September 2013]

Page 31 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

10. Appendix
Program:
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
void menu()
{
clrscr();
printf("n Main Menu");
printf("n 1. Create Pattern ");
printf("n 2. Print Series");
printf("n 3. Work with Records");
printf("n 4. Use Numeric Functions");
printf("n 5. Work with arrays");
printf("n 6. Exit");
}
struct Emp
{
intempCode;
charempName[50];
charempDept[20];
};
/* ====1.1 Creat Pattern for pyramid of asterisks==== */
void asterisk()
{
int n, c, k;
printf("Enter number of rowsn");
scanf("%d",&n);
for ( c = 1 ; c <= n ; c++ )
{
Page 32 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

for( k = 1 ; k <= c ; k++ )
printf("*");
printf("n");
}
}
/* ====1.2 Creat Pattern for pyramid of numbers==== */
voidpyramid_numbers()
{
intnum,r,c;
printf("Enter any number: ");
scanf("%d", &num);
for(r=1; r<=num; r++)
{
for(c=num; c>=r; c--)
printf("%d",c);
printf("n");
}
}
/* ====1.3 Creat Pattern for square of asterisks==== */
voidsquare_asterisk()
{
intnum,r,c;
printf("Enter loop repeat number(rows): ");
scanf("%d",&num);
for(r=1; num>=r; r++)
{
for(c=1; c<=num; c++)
printf("*");
printf("n");
}
}
/* ====2.1 Print series of Armstrong numbers between 1 and 500==== */
Page 33 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

void Armstrong()
{
inti,j,k,l,m,n;
for (i=1;i<=500;i++)
{
j=i%10;
k=i/10;
l=k%10;
m=k/10;
n=(m*m*m)+(l*l*l)+(j*j*j);
if (n==i)
printf("%d n",i);
}
}
/* ====2.2 Print series of Fibonacci series from 1 to 100 using recursion==== */
void Fibonacci()
{
intold_number;
intcurrent_number;
intnext_number;
old_number = 1;
current_number = 1;
printf("1n");
while (current_number< 100) {
printf("%dn", current_number);
next_number = current_number + old_number;
old_number = current_number;
current_number = next_number;
}
}
/* ====2.3 Print series of prime numbers from 1 to 100==== */
void prime()
Page 34 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

{
intn,div,p;
intnum=100;
for(n=2; n<=num; n++)
{
for(div=2; div<n; div++)
{
if(n%div==0)
{
p=0;
break;
}
p=1;
}
if(p)
printf("t%d",n);
}
}
/* ====3.1 Work with Records to Enter and Display Employee Information==== */
voidemp_information()
{
struct Emp e[3];
inti=1,j=1;
char name[50],dept[20];
for(i=1;i<=3;++i)
{
printf("nn Employee : %d", i);
printf("n Enter the Employee Code : ");
scanf("%d",&e[i].empCode);
printf("Enter the Employee Name : ");
scanf("%s",&name);
strcpy(e[i].empName,name);
Page 35 of 44
Introduction to C ProgrammingCE00312-1

printf("Enter the Department

Individual Assignment

: ");

scanf("%s",&dept);
strcpy(e[i].empDept,dept);
}
printf("nnn Employee Details ");
for(j=1;j<=3;++j)
{
printf("nn Employee : %d",j);
printf("n Employee Code : %d",e[j].empCode);
printf("n Employee Name : %s",e[j].empName);
printf("n Department

: %s",e[j].empDept);

}
}
/* ====3.2 Work with Records to Find Grade for a student==== */
voidgrade_student()
{
char name[50];
introll,marks;
printf("Enter student name:-- ");
scanf("%s",&name);
printf("Enter roll number of student:-- ");
scanf("%d",&roll);
printf("Enter total marks of student:-- ");
scanf("%d",&marks);
printf("nName of student is:-- %s",name);
printf("nRoll number is:-- %d",roll);
if(marks>=70)
printf("nYour Grade is A");
else if(marks>=60 && marks<=69)
printf("nYour Grade is B");
else if(marks>=50 && marks<=59)
printf("nYour Grade is C");
Page 36 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

else if(marks<50)
printf("nYour Grade is D");
else
printf("n Kindly enter a valid marks");
}
/* ====4.1 Use Numeric Functions for Factorial of a number using while loop ==== */
void factorial()
{
unsigned long longint f;
inta,i;
printf("nEnter a number: ");
scanf("%d",&a);
if(a<0)
{
printf("nPlease enter a positive number");
factorial();
}
else
{
f=1;
i=1;
while(i<=a)
{
f = f * i;
i++;
}
printf("Factorial: %lu",f);
}
}
/* ====4.2 Use Numeric Functions for Sum of first and fifth digit of a 5 digit number ====
*/
voidsum_of_first_to_fifth()
Page 37 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

{
int number, last_digit, first_digit, total;
printf (" Enter a five digit numeber: ");
scanf ("%d", &number);
last_digit = number % 10;
total = last_digit;
first_digit = (number / 10000) % 10;
total = total + first_digit;
printf ("The total of the first and the last digit of the entered number is: %d", total);
}
/* ====4.3 Use Numeric Functions to Find out whether a 5 digit number is palindrome or
not==== */
voidpalindrom()
{
intnum,rem,i,rev=0,num1,count=0;
printf("Enter the five digit number:n");
scanf("%d",&num);
num1=num;
while(num>0)
{
rem=num%10;
rev=rem+rev*10;
num=num/10;
count++;
}
if(count==5)
{
if(num1==rev)
{
printf("The Given Number %d is Palindrome",num1);
}
else
Page 38 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

{
printf("The Given Number %d is NOT Palindrome",num1);
}
}
else
{
printf("The given %d number is not a five digit number!",num1);
}
}
/* ====5.1 Work with Arrays to Count number of vowels in the sentence==== */
voidcount_vowel()
{
char sentence[80];
inti, vowels = 0, consonants = 0, special = 0;

printf("Enter a word n");
scanf("%s",&sentence);
for (i = 0; sentence[i] != '0'; i++)
{
if ((sentence[i] == 'a' || sentence[i] == 'e' || sentence[i] ==
'i' || sentence[i] == 'o' || sentence[i] == 'u') ||
(sentence[i] == 'A' || sentence[i] == 'E' || sentence[i] ==
'I' || sentence[i] == 'O' || sentence[i] == 'U'))
{
vowels = vowels + 1;
}
else
{
consonants = consonants + 1;
}
if (sentence[i] =='t' ||sentence[i] =='0' || sentence[i] ==' ')
{
Page 39 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

special = special + 1;
}
}
consonants = consonants - special;
printf("No. of vowels in %s = %dn", sentence, vowels);
printf("No. of consonants in %s = %dn", sentence, consonants);
getch();
}

/* ====5.2 Work with Arrays to Copy the contents of an array into another==== */
voidcopy_array()
{
int source[100], dest[100],i,j,no;
clrscr();
printf("Enter the number of values to be enterd: ");
scanf("%d",&no);
for(i=0;i<no;i++){
printf("Enter the value of array no. %d :",i+1);
scanf("%d",&source[i]);
}
for(i=0,j=no-1;i<no;i++,j--){
dest[j]=source[i];
}
printf("Destination array:n");
for(i=0;i<no;i++){
printf("%dt",dest[i]);
}
}
/* ====5.3 Work with Arrays to Delete item from an array==== */
voiddelete_array()
{
int array[100], position, c, n;
Page 40 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

printf("Enter number of elements in arrayn");
scanf("%d", &n);
printf("Enter %d elementsn", n);
for ( c = 0 ; c < n ; c++ )
scanf("%d", &array[c]);
printf("Enter the location where you wish to delete elementn");
scanf("%d", &position);
if ( position >= n+1 )
printf("Deletion not possible.n");
else
{
for ( c = position - 1 ; c < n - 1 ; c++ )
array[c] = array[c+1];
printf("Resultant array isn");
for( c = 0 ; c < n - 1 ; c++ )
printf("%dn", array[c]);
}
}
void main()
{
intch;
charans;
menu:
do{
clrscr();
menu();
printf("n ENTER CHOICE ....");
scanf("%d",&ch);
switch(ch)
{
case 1:
clrscr();
Page 41 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

printf("tt ******** CREATE PATTERN ********");
printf("n1. Pyramid of asterisks ");
printf("n2. Pyramid of numbers");
printf("n3. Square of asterisks");
printf("nn Enter choice...");
scanf("%d",&ch);
switch(ch)
{
case 1: asterisk(); break;
case 2: pyramid_numbers(); break;
case 3: square_asterisk(); break;
default: printf("Wrong choicenn");
goto menu;
}
break;
case 2:
clrscr();
printf("nntt ******** PRINT SERIES *******");
printf("n1. Series of Armstrong numbers between 1 and 500 ");
printf("n2. Fibonacci series from 1 to 100 using recursion");
printf("n3. Series of prime numbers from 1 to 100");
printf("nnEnter your choice.....");
scanf("%d",&ch);
switch(ch)
{
case 1: Armstrong(); break;
case 2: Fibonacci(); break;
case 3: prime(); break;
default: printf("Wrong choicenn");
goto menu;
}
break;
Page 42 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

case 3:
clrscr();
printf("nntt ******* WORK WITH RECORDS *******");
printf("n1. Enter and Display Employee Information ");
printf("n2. Find Grade for a student");
printf("nnEnter your choice.....");
scanf("%d",&ch);
switch(ch)
{
case 1: emp_information(); break;
case 2: grade_student(); break;
default: printf("Wrong choicenn");
goto menu;
}
break;
case 4:
clrscr();
printf("nntt ******* USE NUMERIC FUNCTION *******");
printf("n1. Factorial of a number using while loop ");
printf("n2. Sum of first and fifth digit of a 5 digit number.");
printf("n3. Find out whether a 5 digit number is palindrome or not.");
printf("nnEnter your choice.....");
scanf("%d",&ch);
switch(ch)
{
case 1: factorial(); break;
case 2: sum_of_first_to_fifth(); break;
case 3: palindrom(); break;
default: printf("Wrong choicenn");
goto menu;
}
break;
Page 43 of 44
Introduction to C ProgrammingCE00312-1

Individual Assignment

case 5:
clrscr();
printf("nntt ******** WORK WITH ARRAYS ********");
printf("n1. Count number of vowels in the sentence");
printf("n2. Copy the contents of an array into another.");
printf("n3. Delete item from an array.");
printf("nnEnter your choice.....");
scanf("%d",&ch);
switch(ch)
{
case 1: count_vowel(); break;
case 2: copy_array(); break;
case 3: delete_array(); break;
default:
printf("Wrong choicenn");
goto menu;
}
break;
case 6:
printf("nn Thanks");
printf("nn See you again");
exit (0);
default:
goto menu;
}
printf("nnPress y to continuee....");
scanf("%s",&ans);
}
while(ans=='y'||ans=='Y');
getch();
}

Page 44 of 44

More Related Content

What's hot

My Project Report Documentation with Abstract & Snapshots
My Project Report Documentation with Abstract & SnapshotsMy Project Report Documentation with Abstract & Snapshots
My Project Report Documentation with Abstract & SnapshotsUsman Sait
 
Introduction to Android Fragments
Introduction to Android FragmentsIntroduction to Android Fragments
Introduction to Android FragmentsSergi Martínez
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Android GPS Tutorial
Android GPS TutorialAndroid GPS Tutorial
Android GPS TutorialAhsanul Karim
 
Android graphics
Android graphicsAndroid graphics
Android graphicsKrazy Koder
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studioParinita03
 
Spring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutesSpring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutesVMware Tanzu
 
Java 8 Date and Time API
Java 8 Date and Time APIJava 8 Date and Time API
Java 8 Date and Time APISualeh Fatehi
 
C programming project by navin thapa
C programming project by navin thapaC programming project by navin thapa
C programming project by navin thapaNavinthp
 
java mini project for college students
java mini project for college students java mini project for college students
java mini project for college students SWETALEENA2
 
MS Paint: Creating an Invitation Card
MS Paint: Creating an Invitation CardMS Paint: Creating an Invitation Card
MS Paint: Creating an Invitation Cardivan anzuategui
 
Multimedia on android
Multimedia on androidMultimedia on android
Multimedia on androidRamesh Prasad
 
Basics and different xml files used in android
Basics and different xml files used in androidBasics and different xml files used in android
Basics and different xml files used in androidMahmudul Hasan
 
Android technical quiz app
Android technical quiz appAndroid technical quiz app
Android technical quiz appJagdeep Singh
 

What's hot (20)

My Project Report Documentation with Abstract & Snapshots
My Project Report Documentation with Abstract & SnapshotsMy Project Report Documentation with Abstract & Snapshots
My Project Report Documentation with Abstract & Snapshots
 
Introduction to Android Fragments
Introduction to Android FragmentsIntroduction to Android Fragments
Introduction to Android Fragments
 
android layouts
android layoutsandroid layouts
android layouts
 
Android GPS Tutorial
Android GPS TutorialAndroid GPS Tutorial
Android GPS Tutorial
 
Android graphics
Android graphicsAndroid graphics
Android graphics
 
Online Social Networking Site
Online Social Networking SiteOnline Social Networking Site
Online Social Networking Site
 
Creating the first app with android studio
Creating the first app with android studioCreating the first app with android studio
Creating the first app with android studio
 
Spring - Ecosistema
Spring - EcosistemaSpring - Ecosistema
Spring - Ecosistema
 
Spring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutesSpring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutes
 
Java 8 Date and Time API
Java 8 Date and Time APIJava 8 Date and Time API
Java 8 Date and Time API
 
C programming project by navin thapa
C programming project by navin thapaC programming project by navin thapa
C programming project by navin thapa
 
17.my sql triggers in laravel
17.my sql triggers in laravel17.my sql triggers in laravel
17.my sql triggers in laravel
 
PROJECT REPORT
PROJECT REPORTPROJECT REPORT
PROJECT REPORT
 
java mini project for college students
java mini project for college students java mini project for college students
java mini project for college students
 
C# Dot net unit-3.pdf
C# Dot net unit-3.pdfC# Dot net unit-3.pdf
C# Dot net unit-3.pdf
 
MS Paint: Creating an Invitation Card
MS Paint: Creating an Invitation CardMS Paint: Creating an Invitation Card
MS Paint: Creating an Invitation Card
 
Multimedia on android
Multimedia on androidMultimedia on android
Multimedia on android
 
Basics and different xml files used in android
Basics and different xml files used in androidBasics and different xml files used in android
Basics and different xml files used in android
 
Online news 365
Online news 365Online news 365
Online news 365
 
Android technical quiz app
Android technical quiz appAndroid technical quiz app
Android technical quiz app
 

Viewers also liked

Acknowledgement For Assignment
Acknowledgement For AssignmentAcknowledgement For Assignment
Acknowledgement For AssignmentThomas Mon
 
Effective Meetings (Assignment)
Effective Meetings (Assignment)Effective Meetings (Assignment)
Effective Meetings (Assignment)umailaila
 
Acknowledgement
AcknowledgementAcknowledgement
Acknowledgementferdzzz
 
Mid term assignment of audit and assurance
Mid term assignment of audit and assuranceMid term assignment of audit and assurance
Mid term assignment of audit and assuranceArslan Akram
 
Measurement assignment site report
Measurement assignment site reportMeasurement assignment site report
Measurement assignment site reportSyafiq Zariful
 
Social psychology video assignment report
Social psychology video assignment reportSocial psychology video assignment report
Social psychology video assignment reportChin Tze Wei
 
Project report on Performance Appraisal of BSNL
Project report on Performance Appraisal of BSNLProject report on Performance Appraisal of BSNL
Project report on Performance Appraisal of BSNLVipul Sachan
 
Thesis blending big data and cloud -epilepsy global data research and inform...
Thesis  blending big data and cloud -epilepsy global data research and inform...Thesis  blending big data and cloud -epilepsy global data research and inform...
Thesis blending big data and cloud -epilepsy global data research and inform...Anup Singh
 
Term paper of cse(211) avdhesh sharma c1801 a24 regd 10802037
Term paper of cse(211) avdhesh sharma c1801 a24 regd 10802037Term paper of cse(211) avdhesh sharma c1801 a24 regd 10802037
Term paper of cse(211) avdhesh sharma c1801 a24 regd 10802037Upendra Sengar
 
Individual assignment on material and supplies management 1
Individual assignment on material and supplies management 1Individual assignment on material and supplies management 1
Individual assignment on material and supplies management 1berhanu taye
 
Acknowledgement
AcknowledgementAcknowledgement
Acknowledgementhothp
 
Minor project report on temple architectur
Minor project report on temple architecturMinor project report on temple architectur
Minor project report on temple architecturMegha Aggarwal
 
My Goals in Life - BBA Orientation Assignment
My Goals in Life - BBA Orientation AssignmentMy Goals in Life - BBA Orientation Assignment
My Goals in Life - BBA Orientation AssignmentAyush Man Tamrakar
 
Employee Management System in C++
Employee Management System in C++Employee Management System in C++
Employee Management System in C++Jayant Gope
 
Frankfinn Personality Development Assignment
Frankfinn Personality Development AssignmentFrankfinn Personality Development Assignment
Frankfinn Personality Development Assignmentprincessminu
 

Viewers also liked (20)

Acknowledgement For Assignment
Acknowledgement For AssignmentAcknowledgement For Assignment
Acknowledgement For Assignment
 
Effective Meetings (Assignment)
Effective Meetings (Assignment)Effective Meetings (Assignment)
Effective Meetings (Assignment)
 
Example of acknowledgment
Example of acknowledgmentExample of acknowledgment
Example of acknowledgment
 
Acknowledgement
AcknowledgementAcknowledgement
Acknowledgement
 
Mid term assignment of audit and assurance
Mid term assignment of audit and assuranceMid term assignment of audit and assurance
Mid term assignment of audit and assurance
 
Measurement assignment site report
Measurement assignment site reportMeasurement assignment site report
Measurement assignment site report
 
Social psychology video assignment report
Social psychology video assignment reportSocial psychology video assignment report
Social psychology video assignment report
 
Project report on Performance Appraisal of BSNL
Project report on Performance Appraisal of BSNLProject report on Performance Appraisal of BSNL
Project report on Performance Appraisal of BSNL
 
Acknowledgement
AcknowledgementAcknowledgement
Acknowledgement
 
Thesis blending big data and cloud -epilepsy global data research and inform...
Thesis  blending big data and cloud -epilepsy global data research and inform...Thesis  blending big data and cloud -epilepsy global data research and inform...
Thesis blending big data and cloud -epilepsy global data research and inform...
 
Term paper of cse(211) avdhesh sharma c1801 a24 regd 10802037
Term paper of cse(211) avdhesh sharma c1801 a24 regd 10802037Term paper of cse(211) avdhesh sharma c1801 a24 regd 10802037
Term paper of cse(211) avdhesh sharma c1801 a24 regd 10802037
 
Individual assignment on material and supplies management 1
Individual assignment on material and supplies management 1Individual assignment on material and supplies management 1
Individual assignment on material and supplies management 1
 
Acknowledgement
AcknowledgementAcknowledgement
Acknowledgement
 
Minor project report on temple architectur
Minor project report on temple architecturMinor project report on temple architectur
Minor project report on temple architectur
 
My Goals in Life - BBA Orientation Assignment
My Goals in Life - BBA Orientation AssignmentMy Goals in Life - BBA Orientation Assignment
My Goals in Life - BBA Orientation Assignment
 
Acknowledgements
AcknowledgementsAcknowledgements
Acknowledgements
 
Employee Management System in C++
Employee Management System in C++Employee Management System in C++
Employee Management System in C++
 
Frankfinn Personality Development Assignment
Frankfinn Personality Development AssignmentFrankfinn Personality Development Assignment
Frankfinn Personality Development Assignment
 
ERGONOMICS
ERGONOMICSERGONOMICS
ERGONOMICS
 
Chemistry Investigatory Project (Class 12 ,CBSE)
Chemistry Investigatory Project (Class 12 ,CBSE)  Chemistry Investigatory Project (Class 12 ,CBSE)
Chemistry Investigatory Project (Class 12 ,CBSE)
 

Similar to C Programming

Summer intern @ 11th12th.com
Summer intern @ 11th12th.comSummer intern @ 11th12th.com
Summer intern @ 11th12th.comVinit Payal
 
Jobportal 130815001657-phpapp01
Jobportal 130815001657-phpapp01Jobportal 130815001657-phpapp01
Jobportal 130815001657-phpapp01Areef Khan
 
online job portal system
online job portal systemonline job portal system
online job portal systemKrishna Ranjan
 
Personality Prediction and CV Analysis System
Personality Prediction and CV Analysis SystemPersonality Prediction and CV Analysis System
Personality Prediction and CV Analysis SystemIRJET Journal
 
Sap basis certification_and_interview_questions_answers_and11237206714
Sap basis certification_and_interview_questions_answers_and11237206714Sap basis certification_and_interview_questions_answers_and11237206714
Sap basis certification_and_interview_questions_answers_and11237206714ramesh469
 
Agile Estimating And Planning
Agile Estimating And PlanningAgile Estimating And Planning
Agile Estimating And PlanningMojammel Haque
 
System Analysis & Design Report on Summer Training System
System Analysis & Design Report on Summer Training SystemSystem Analysis & Design Report on Summer Training System
System Analysis & Design Report on Summer Training Systemthededar
 
Industrial training solid works report by atharva mahalle (19 me001)
Industrial training solid works report by atharva mahalle (19 me001) Industrial training solid works report by atharva mahalle (19 me001)
Industrial training solid works report by atharva mahalle (19 me001) NSVines
 
Informatica complex transformation i
Informatica complex transformation iInformatica complex transformation i
Informatica complex transformation iAmit Sharma
 
osd ncc education assingment l4dc
osd ncc education assingment l4dcosd ncc education assingment l4dc
osd ncc education assingment l4dcDavid Parker
 
Software Engineering Mcqs.pdf
Software Engineering Mcqs.pdfSoftware Engineering Mcqs.pdf
Software Engineering Mcqs.pdfiloveiraq
 
A Project Paper On Smart Gym Management System
A Project Paper On Smart Gym Management SystemA Project Paper On Smart Gym Management System
A Project Paper On Smart Gym Management SystemAmy Roman
 
Gym Management System User Manual
Gym Management System User ManualGym Management System User Manual
Gym Management System User ManualDavid O' Connor
 

Similar to C Programming (20)

Summer intern @ 11th12th.com
Summer intern @ 11th12th.comSummer intern @ 11th12th.com
Summer intern @ 11th12th.com
 
Jobportal 130815001657-phpapp01
Jobportal 130815001657-phpapp01Jobportal 130815001657-phpapp01
Jobportal 130815001657-phpapp01
 
online job portal system
online job portal systemonline job portal system
online job portal system
 
Personality Prediction and CV Analysis System
Personality Prediction and CV Analysis SystemPersonality Prediction and CV Analysis System
Personality Prediction and CV Analysis System
 
c++ lab manual
c++ lab manualc++ lab manual
c++ lab manual
 
E-work ppt
E-work pptE-work ppt
E-work ppt
 
Final Document
Final DocumentFinal Document
Final Document
 
Sap basis certification_and_interview_questions_answers_and11237206714
Sap basis certification_and_interview_questions_answers_and11237206714Sap basis certification_and_interview_questions_answers_and11237206714
Sap basis certification_and_interview_questions_answers_and11237206714
 
Agile Estimating And Planning
Agile Estimating And PlanningAgile Estimating And Planning
Agile Estimating And Planning
 
System Analysis & Design Report on Summer Training System
System Analysis & Design Report on Summer Training SystemSystem Analysis & Design Report on Summer Training System
System Analysis & Design Report on Summer Training System
 
Industrial training solid works report by atharva mahalle (19 me001)
Industrial training solid works report by atharva mahalle (19 me001) Industrial training solid works report by atharva mahalle (19 me001)
Industrial training solid works report by atharva mahalle (19 me001)
 
Informatica complex transformation i
Informatica complex transformation iInformatica complex transformation i
Informatica complex transformation i
 
Project 2
Project 2Project 2
Project 2
 
osd ncc education assingment l4dc
osd ncc education assingment l4dcosd ncc education assingment l4dc
osd ncc education assingment l4dc
 
Software Engineering Mcqs.pdf
Software Engineering Mcqs.pdfSoftware Engineering Mcqs.pdf
Software Engineering Mcqs.pdf
 
A Project Paper On Smart Gym Management System
A Project Paper On Smart Gym Management SystemA Project Paper On Smart Gym Management System
A Project Paper On Smart Gym Management System
 
ASAD Project Report
ASAD Project ReportASAD Project Report
ASAD Project Report
 
Gym Management System User Manual
Gym Management System User ManualGym Management System User Manual
Gym Management System User Manual
 
NSTIP User's Guide
NSTIP User's GuideNSTIP User's Guide
NSTIP User's Guide
 
Online Test
Online TestOnline Test
Online Test
 

More from Prince Kumar

A letter from mom and dad
A letter from mom and dadA letter from mom and dad
A letter from mom and dadPrince Kumar
 
Factors influencing creativity
Factors influencing creativityFactors influencing creativity
Factors influencing creativityPrince Kumar
 
Online Railway Reservation System
Online Railway Reservation SystemOnline Railway Reservation System
Online Railway Reservation SystemPrince Kumar
 
Car portal- Ewa final assignment
Car portal- Ewa final assignmentCar portal- Ewa final assignment
Car portal- Ewa final assignmentPrince Kumar
 
Prisoner Management System
Prisoner Management SystemPrisoner Management System
Prisoner Management SystemPrince Kumar
 
Hotel Management system in C++
Hotel Management system in C++ Hotel Management system in C++
Hotel Management system in C++ Prince Kumar
 
SAD - Waiter on Wheels
SAD - Waiter on WheelsSAD - Waiter on Wheels
SAD - Waiter on WheelsPrince Kumar
 
Professional enterprise and development - IBM
Professional enterprise and development - IBMProfessional enterprise and development - IBM
Professional enterprise and development - IBMPrince Kumar
 
Feedback System in PHP
Feedback System in PHPFeedback System in PHP
Feedback System in PHPPrince Kumar
 

More from Prince Kumar (12)

A letter from mom and dad
A letter from mom and dadA letter from mom and dad
A letter from mom and dad
 
Factors influencing creativity
Factors influencing creativityFactors influencing creativity
Factors influencing creativity
 
Personality test
Personality testPersonality test
Personality test
 
Online Railway Reservation System
Online Railway Reservation SystemOnline Railway Reservation System
Online Railway Reservation System
 
Car portal- Ewa final assignment
Car portal- Ewa final assignmentCar portal- Ewa final assignment
Car portal- Ewa final assignment
 
College Network
College NetworkCollege Network
College Network
 
Prisoner Management System
Prisoner Management SystemPrisoner Management System
Prisoner Management System
 
Positive attitude
Positive attitudePositive attitude
Positive attitude
 
Hotel Management system in C++
Hotel Management system in C++ Hotel Management system in C++
Hotel Management system in C++
 
SAD - Waiter on Wheels
SAD - Waiter on WheelsSAD - Waiter on Wheels
SAD - Waiter on Wheels
 
Professional enterprise and development - IBM
Professional enterprise and development - IBMProfessional enterprise and development - IBM
Professional enterprise and development - IBM
 
Feedback System in PHP
Feedback System in PHPFeedback System in PHP
Feedback System in PHP
 

Recently uploaded

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 

Recently uploaded (20)

mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 

C Programming

  • 1. Introduction to C ProgrammingCE00312-1 Individual Assignment APIIT SD INDIA Module Code: CE00312-1 Module title: Introduction to C programming Submitted by: Prince Kumar E-mail id: prince_karan640035@yahoo.com Page 1 of 44
  • 2. Introduction to C ProgrammingCE00312-1 Individual Assignment Acknowledgement I would like to use this opportunity to thank all who lend their hand for completing our project successfully. First of all I would like to thank Almighty, who drove us through our project with his blessing and providing us with enough support to make it a success. I would then like to thank our project supervisor Miss XYZ who was there to guide us along the project, providing us assistance in doing the things in a proper and appropriate manner. Without her supervision this project would have been a tedious task for us. Also I would like to extend our gratitude to my friends, lab assistants, the librarian and management for providing us with good services and creating an environment for carrying out our project. At last I am thankful to APIIT SD INDIA for giving me this opportunity to carry out my C Assignment which contributed in enhancing my skill and knowledge in C Language. Page 2 of 44
  • 3. Introduction to C ProgrammingCE00312-1 Individual Assignment Contents Acknowledgement .........................................................................................................................................2 1. Introduction...............................................................................................................................................4 1.1 Objective .......................................................................................................................................4 2. Project Description ...................................................................................................................................4 3. Program Design using Pseudo-code ........................................................................................................8 4. Segment of Code......................................................................................................................................11 4.1 Create Pattern ...................................................................................................................................14 4.1.1 Pyramid of asterisks ..................................................................................................................14 4.1.2 Pyramid of numbers ..................................................................................................................14 4.1.3 Square of asterisks .....................................................................................................................15 4.2 Print Series ........................................................................................................................................15 4.2.1 Series of Armstrong numbers between 1 and 500. ..................................................................15 4.2.2 Fibonacci series from 1 to 100 using recursion. ......................................................................16 4.2.3 Series of prime numbers from 1 to 100. ...................................................................................16 4.3 Work with Records ...........................................................................................................................17 4.3.1 Enter and Display Employee Information ...............................................................................17 4.3.2 Find Grade for a student ...........................................................................................................17 4.4 Use Numeric Functions.....................................................................................................................18 4.4.1 Factorial of a number using while loop ....................................................................................18 4.4.2 Sum of first and fifth digit of a 5 digit number. ......................................................................19 4.4.3 Find out whether a 5 digit number is palindrome or not. ......................................................19 4.5 Work with Arrays ......................................................................................................................20 4.5.1 Count number of vowels in the sentence. .............................................................................20 4.5.2 Copy the contents of an array into another. ........................................................................21 4.5.3 Delete item from an array .....................................................................................................21 4.6 Exit ..............................................................................................................................................22 5. User guide with Sample Input Output Screens ....................................................................................22 6. Limitations and Future Enhancements.................................................................................................27 7. Test Plan AND RESULT ...........................................................................................................................27 8. Conclusion ...............................................................................................................................................30 9. References ................................................................................................................................................31 10. Appendix ................................................................................................................................................32 Page 3 of 44
  • 4. Introduction to C ProgrammingCE00312-1 Individual Assignment 1. Introduction C is a programming language developed at USA in 1972 by DENNIS RITCHIE. After that time the popularity of C is gone on increasing without any advertisement. C is a successor of B language which was introduced around 1970 The language was formalized in 1988 by the American National Standard Institute (ANSI). By 1973 UNIX OS almost totally written in C. Today C is the most widely used System Programming Language. Most of the state of the art software have been implemented using C. C was invented to write an operating system called UNIX. 1.1 Objective Be able to design, implement and document in well-organized manner. Explain the structure, functions, array and correct use of many features and implementation in appropriate advance manner to make application attractive. 2. Project Description In our Program, there is optimized programming which contributes to the programs in menu driven. The functionality of our program would be in the order of 1, 2, 3,4,5, and 6 in menu driven. There are six option in main menuCreate Pattern,Print Series, Work with Records, Use Numeric Functions, Work with Arrays and Exit. Each case contains another switch functionality to perform following function:I. Create Pattern After selecting this option, menu will be provided for the following sub options: 1. Pyramid of asterisks 2. Pyramid of numbers 3. Square of asterisks User will enter the sub-option and based upon it the following steps will execute Pyramid of asterisks System will ask for the number of rows of pattern from the user and will display the pattern accordingly. Like: If he entered 6 then the output is: * ** *** Page 4 of 44
  • 5. Introduction to C ProgrammingCE00312-1 Individual Assignment **** ***** ****** Pyramid of numbers System will ask for the number of rows of pattern from the user and will display the pattern accordingly. Like: If he entered 6 then the output will be: 654321 65432 6543 654 65 6 Square of asterisks System will ask for the number of rows of pattern from the user and will display the pattern accordingly Like: If he entered 6 then the output will be: ****** ****** ****** ****** ****** ****** II. Print Series After selecting this option, menu will be provided for the following sub options. 1. Series of Armstrong numbers between 1 and 500. 2. Fibonacci series from 1 to 100 using recursion. 3. Series of prime numbers from 1 to 100. User will be asked to choose the sub-option and based upon that the result will be displayed on the screen. Page 5 of 44
  • 6. Introduction to C ProgrammingCE00312-1 III. Individual Assignment Work with Records After selecting this option, menu will be provided for the following sub options. 1. Enter and Display Employee Information 2. Find Grade for a student User will be asked to choose the sub-option and based upon that the following steps should execute: Enter and Display Employee Information In this option, array of structures should be used to hold employee information like employee code, name etc. User will enter the information of three employees and after that system will display the information of all the three employees on the screen. Like: If he entered Employee code: 1, Employee Name: XYZ and Department: HR Then the output will be Employee Code: 1 Employee Name: Xyz Department: HR Find Grade for a student In this option, system will accept roll number, name and total marks of a student and will display roll number, name and grade. A criteria for finding the grade is as follows: If Marks >=70 grade is A If Marks between 60 and 69 grade is B If Marks between 50 and 59 grade is C If Marks <50 grade is D Like: If he entered 80 then the output will be A If he entered 65 then the output will be B If he entered 55 then the output will be C If he entered 40 then the output will be D IV. Use Numeric Functions After selecting this option, menu will be provided for the following sub options. 1. Factorial of a number using while loop 2. Sum of first and fifth digit of a 5 digit number. 3. Find out whether a 5 digit number is palindrome or not. After selecting the sub-option, user will be asked to enter the appropriate number and the calculations will be performed accordingly. Factorial of a number using while loop. Page 6 of 44
  • 7. Introduction to C ProgrammingCE00312-1 Individual Assignment It will take number from the user and display the factorial of number. Like If user entered 4 then the factorial is 24 it will calculate like this 4*3*2*1 Sum of first and fifth digit of a 5 digit number. It will take input from the user and it will sum of first and fifth digit number. Like If user entered 12345 then it will take first and fifth digit and the answer is 6. Find out whether a 5 digit number is palindrome or not. Like If user entered 12321 then it will show 12321 is palindrome and if user entered 12345 then it will show the entered number is not palindrome. V. Work with Arrays After selecting this option, menu will be provided for the following sub options. 1. Count number of vowels in the sentence. 2. Copy the contents of an array into another. 3. Delete item from an array After selecting the sub-option, user will be asked to enter the size of the array for the option 2 And 3, after that appropriate array will be entered and result will be displayed accordingly. Maximum size of the array will be 100. Count number of vowels in the sentence. It will count vowels from the sentence and display number of vowels and constants distinctly This will count the vowels in sentence Like If user entered “working” then it will show Number of vowels in working = 2 Number of constant in working = 5 Copy the contents of an array into another. If user entered 3 then it will take 3 input and display in one array. Like If user entered Enter the value of array 1 = 1 Enter the value of array 2 = 2 Enter the value of array 3 = 3 Then Page 7 of 44
  • 8. Introduction to C ProgrammingCE00312-1 Individual Assignment It will show Destination array = 3 2 1. Delete item from an array This will delete item from taken element Like It will take number of input number like if user entered 5 then user has to entered 5 input 1 2 3 4 5 Then it will ask to delete the item from array. If user entered 3 then it will show 1 2 4 5 VI. Exit This option is used to exit from the system 3. Program Design using Pseudo-code 3.1 Create Pattern 3.1.1 Pyramid of asterisks Step1: START Step2: Function Asterisk Step3: Read n,c,k Step4: Display Step5: Input n Step6: Loop C from 1 to x. End Loop Step7: Display * Step8: STOP 3.1.2 Pyramid of numbers Step1: START Step2: Function Pyramid Numbers Step3: Read num,r,c Step4: Display Step5: Input num Step6: Loop R from num to r. End Loop Page 8 of 44
  • 9. Introduction to C ProgrammingCE00312-1 Individual Assignment Step7: Display c Step8: STOP 3.1.3 Square of asterisks Step1: START Step2: Function square_asterisk Step3: Read num,r,c Step4: Display Step5: Input num Step6: Loop C from 1 to x. End Loop Step7: Display * Step8: STOP 3.2 Print Series 3.2.1 Series of Armstrong numbers between 1 and 500. Step1: START Step2: Function Armstrong Step3: Read i,j,k,l,m,n; Step4: Loop 1 from 1 to 500. j=i%10; k=i/10; l=k%10; m=k/10; n=(m*m*m)+(l*l*l)+(j*j*j); if (n==i) End Loop Step5: Display i Step6: STOP 3.2.2 Fibonacci series from 1 to 100 using recursion. Step1: START Step2: Function Fibonacci Step3: Read old_number, current_number, next_number Step4: Display Step5: While (current_number < 100) Step6: Display Step7: STOP 3.2.3 Series of prime numbers from 1 to 100. Step1: START Step2: Function Prime Step3: Read n,div,p, num=100 Step4: FOR LOOP N from 2 to num :for(n=2; n<=num; n++) :{ :for(div=2; div<n; div++) :{ :if(n%div==0) :{ :p=0; :break; :} Page 9 of 44
  • 10. Introduction to C ProgrammingCE00312-1 Individual Assignment :p=1; :} :if(p) : END LOOP Step5: Display n Step6: STOP 3.3 Work with Records 3.3.1 Enter and Display Employee Information Step1: START Step2: Function emp_information Step3: Read i=1,j=1 name[50],dept[20] Step4: FOR LOOP I from 1 to 3 END LOOP Step5: Display i and employee code Step6: Read empCode Step7: STOP 4.3.2 Find Grade for a student Step1: START Step2: Function grade_student Step3: Read name[50], roll, marks Step4: Display Step5:Input Step6: Display Step7: Input Step8: Display Step9: Display IF Step10: Display ELSE IF Step11:Display ELSE IF Step12: Display ELSE IF Step13: Display ELSE Step14: Display Step15: STOP 3.4 Use Numeric Functions 3.4.1 Factorial of a number using while loop Step1: START Step2: Function factorial Step3: Read a,i Step4: Display Step5: Input a Step6: IF : Display : ELSE Page 10 of 44
  • 11. Introduction to C ProgrammingCE00312-1 Individual Assignment { f=1; i=1; while(i<=a) { f = f * i; i++; } Step7: Display Stop8: STOP 4. Segment of Code and Concepts Concepts Various C programming concepts have been applied in the program to make it as requested by the project. We have included the wide variety of the c data handling techniques and control structures to construct the whole program. Following are the concepts used in the assignment and their elaboration with the sample code from the program. Decision Control Structure: There are three ways for taking decision in the program and they are – IF-ELSE statement: If else statement has been frequently used in the program to facilitate the user to make the selection between the conditions based on the choice made. The sample code is shown below: if (decimal_number1 >= decimal_number2) { flag = 0; decimal_number3 = decimal_number1 – decimal_number2; } else { flag = 1; decimal_number3 = decimal_number2 – decimal_number1; } Switch statement: The developers have included many switch statements in the program whenever there is the necessity to make the choices between multiple options. The main benefit of using switch statement is that it will not take the control to scan each statement and execute the correct one but the control will directly jump to the provided case. Switch (temp_number[i]) { case‘0’: number = number*10 + 0; break; Page 11 of 44
  • 12. Introduction to C ProgrammingCE00312-1 case‘1’: case‘2’: case‘3’: case‘4’: case‘5’: case‘6’: case‘7’: case‘8’: case‘9’: number number number number number number number number number = = = = = = = = = Individual Assignment number*10 number*10 number*10 number*10 number*10 number*10 number*10 number*10 number*10 + + + + + + + + + 1; 2; 3; 4; 5; 6; 7; 8; 9; break; break; break; break; break; break; break; break; break; } Nested IF-ELSE We have also included the nested if else statements whenever felt necessary. The sample code is given below. if (ch == 49 ||ch == 48) { printf("%c",ch); temp_number[i] = ch; i++; } elseif((ch == 8) && (i != 0)) { printf("b"); printf(" "); printf("b"); if (i!=0) { i--; } continue; } Loop Control Structure – Looping constructs are used in assignments where the multiple iterations were to be used for taking the passwords, calculating the totals, searching etc. Following are the sample codes for the different types of looping constructs used in the program. For Looping structure: for(i = node.char_count; node.temp_string[i] != '0'; i++) { printf("%c",node.temp_string[i]); } While Looping structure: while(i!=20) { ch = getch(); if (ch == 13) { break; } Page 12 of 44
  • 13. Introduction to C ProgrammingCE00312-1 Individual Assignment if (ch == 8) { if (i!=0) { printf("b"); printf(" "); printf("b"); i--; } } else { printf("%c",ch); first_string[i] = ch; i++; } Symbolic Constants Symbolic constants are used in the program to make the program scalable. The length of string array are defined at the very beginning of the program. #define SIZE 20 Functions and pointers: The whole program consists of many of the functions calling each other to perform the task such as calculating determinant etc. Pointers are also used to pass through functions to change the original values of in the memory location. Example of function calling with Arguments: int determinent_solution(int **a,int order) { int **temp,i, j, k = 0, b = 0, deter = 0, coloumn_position, minor_value = 0; temp = malloc((5) * sizeof(int *)); for(i = 0; i < 5; i++) { temp[i] = malloc(5 * sizeof(int *)); } Arrays Arrays are used to store the numeric data or the characters. Character arrays in the form of string are used to store the information. The different numeric data after the calculation are also stored in the array: Examples of arrays in program (character arrays included) void matrix_addition() // Array to store elements of matrices { int first_matrix[6][6], second_matrix[6][6], result_matrix[6][6],row[2],coloumn[2],count = 0,i,j; Page 13 of 44
  • 14. Introduction to C ProgrammingCE00312-1 Individual Assignment Structures Structures are used to store the string and a integer variable used in case of finding the number of characters in string. Structures are initialized outside the main function to make it global and the members of structures are accessed in the program wherever necessary. Sample code for structure struct search_char{ char temp_string[SIZE]; int char_count; }node; 4.1 Create Pattern 4.1.1 Pyramid of asterisks void asterisk() { Initialization of variables int n, c, k; printf("Enter number of rowsn"); scanf("%d",&n); Performed for ( c = 1 ; c <= n ; c++ ) Pyramid of asterisks { for( k = 1 ; k <= c ; k++ ) printf("*"); printf("n"); } } 4.1.2 Pyramid of numbers voidpyramid_numbers() { intnum,r,c; printf("Enter any number: "); scanf("%d", &num); for(r=1; r<=num; r++) { for(c=num; c>=r; c--) printf("%d",c); printf("n"); } } Initialization of variables Performed Pyramid of Numbers Page 14 of 44
  • 15. Introduction to C ProgrammingCE00312-1 Individual Assignment 4.1.3 Square of asterisks voidsquare_asterisk() { Initialization of variables intnum,r,c; printf("Enter loop repeat number(rows): "); scanf("%d",&num); for(r=1; num>=r; r++) { Performed for(c=1; c<=num; c++) Square of asterisks printf("*"); printf("n"); } } 4.2 Print Series 4.2.1 Series of Armstrong numbers between 1 and 500. void Armstrong() { Initialization of variables inti,j,k,l,m,n; for (i=1;i<=500;i++) { j=i%10; k=i/10; Performed l=k%10; Series of Armstrong numbers between 1 and 500 m=k/10; n=(m*m*m)+(l*l*l)+(j*j*j); if (n==i) printf("%d n",i); } } Page 15 of 44
  • 16. Introduction to C ProgrammingCE00312-1 Individual Assignment 4.2.2 Fibonacci series from 1 to 100 using recursion. void Fibonacci() { intold_number; intcurrent_number; intnext_number; Initialization of variables old_number = 1; current_number = 1; printf("1n"); while (current_number< 100) { printf("%dn", current_number); next_number = current_number + old_number; old_number = current_number; Performed Fibonacci series from 1 to 100 using recursion. current_number = next_number; } } 4.2.3 Series of prime numbers from 1 to 100. void prime() { intn,div,p; intnum=100; for(n=2; n<=num; n++) { for(div=2; div<n; div++) Performed { Series of prime numbers from 1 to 100. if(n%div==0) { p=0; break; } p=1; } if(p) printf("t%d",n); Page 16 of 44
  • 17. Introduction to C ProgrammingCE00312-1 Individual Assignment } } 4.3 Work with Records 4.3.1 Enter and Display Employee Information voidemp_information() { struct Emp e[3]; Initialization of variables inti=1,j=1; char name[50],dept[20]; for(i=1;i<=3;++i) { printf("nn Employee : %d", i); printf("n Enter the Employee Code : "); scanf("%d",&e[i].empCode); printf("Enter the Employee Name : "); scanf("%s",&name); strcpy(e[i].empName,name); printf("Enter the Department : "); scanf("%s",&dept); Performed strcpy(e[i].empDept,dept); Enter and Display Employee Information } printf("nnn Employee Details "); for(j=1;j<=3;++j) { printf("nn Employee : %d",j); printf("n Employee Code : %d",e[j].empCode); printf("n Employee Name : %s",e[j].empName); printf("n Department : %s",e[j].empDept); } } 4.3.2 Find Grade for a student voidgrade_student() { Page 17 of 44
  • 18. Introduction to C ProgrammingCE00312-1 char name[50]; Individual Assignment Initialization of variables introll,marks; printf("Enter student name:-- "); scanf("%s",&name); printf("Enter roll number of student:-- "); scanf("%d",&roll); printf("Enter total marks of student:-- "); scanf("%d",&marks); printf("nName of student is:-- %s",name); printf("nRoll number is:-- %d",roll); if(marks>=70) printf("nYour Grade is A"); else if(marks>=60 && marks<=69) printf("nYour Grade is B"); Performed else if(marks>=50 && marks<=59) Find Grade for a student printf("nYour Grade is C"); else if(marks<50) printf("nYour Grade is D"); else printf("n Kindly enter a valid marks"); } 4.4 Use Numeric Functions 4.4.1 Factorial of a number using while loop void factorial() { unsigned long longint f; inta,i; printf("nEnter a number: "); scanf("%d",&a); if(a<0) { printf("nPlease enter a positive number"); Page 18 of 44
  • 19. Introduction to C ProgrammingCE00312-1 Individual Assignment factorial(); } Performed else Find Grade for a student { f=1; i=1; while(i<=a) { f = f * i; i++; } printf("Factorial: %lu",f); } } 4.4.2 Sum of first and fifth digit of a 5 digit number. voidsum_of_first_to_fifth() { int number, last_digit, first_digit, total; Initialization of variables printf (" Enter a five digit numeber: "); scanf ("%d", &number); last_digit = number % 10; Performed total = last_digit; Sum of first and fifth digit of a 5 digit number first_digit = (number / 10000) % 10; total = total + first_digit; printf ("The total of the first and the last digit of the entered number is: %d", total); } 4.4.3 Find out whether a 5 digit number is palindrome or not. voidpalindrom() { intnum,rem,i,rev=0,num1,count=0; printf("Enter the five digit number:n"); scanf("%d",&num); num1=num; while(num>0) Initialization of variables Page 19 of 44
  • 20. Introduction to C ProgrammingCE00312-1 Individual Assignment { rem=num%10; rev=rem+rev*10; num=num/10; count++; } if(count==5) { if(num1==rev) { printf("The Given Number %d is Palindrome",num1); } else { printf("The Given Number %d is NOT Palindrome",num1); } } else { printf("The given %d number is not a five digit number!",num1); } Performed Find out whether a 5 digit number is palindrome or not. } 4.5 Work with Arrays 4.5.1 Count number of vowels in the sentence. voidcount_vowel() { char sentence[80]; inti, vowels = 0, consonants = 0, special = 0; printf("Enter a word n"); scanf("%s",&sentence); for (i = 0; sentence[i] != '0'; i++) { if ((sentence[i] == 'a' || sentence[i] == 'e' || sentence[i] == 'i' || sentence[i] == 'o' || sentence[i] == 'u') || (sentence[i] == 'A' || sentence[i] == 'E' || sentence[i] == 'I' || sentence[i] == 'O' || sentence[i] == 'U')) { vowels = vowels + 1; } else { consonants = consonants + 1; } if (sentence[i] =='t' ||sentence[i] =='0' || sentence[i] ==' ') { Page 20 of 44 Performed Count number of vowels in the sentence
  • 21. Introduction to C ProgrammingCE00312-1 Individual Assignment special = special + 1; } } consonants = consonants - special; printf("No. of vowels in %s = %dn", sentence, vowels); printf("No. of consonants in %s = %dn", sentence, consonants); getch(); } 4.5.2 Copy the contents of an array into another. voidcopy_array() { int source[100], dest[100],i,j,no; Initialization of variables clrscr(); printf("Enter the number of values to be enterd: "); scanf("%d",&no); for(i=0;i<no;i++){ printf("Enter the value of array no. %d :",i+1); scanf("%d",&source[i]); } Performed for(i=0,j=no-1;i<no;i++,j--){ Copy the contents of an array into another dest[j]=source[i]; } printf("Destination array:n"); for(i=0;i<no;i++){ printf("%dt",dest[i]); } } 4.5.3 Delete item from an array voiddelete_array() { int array[100], position, c, n; Initialization of variables printf("Enter number of elements in arrayn"); scanf("%d", &n); printf("Enter %d elementsn", n); for ( c = 0 ; c < n ; c++ ) scanf("%d", &array[c]); Page 21 of 44
  • 22. Introduction to C ProgrammingCE00312-1 Individual Assignment printf("Enter the location where you wish to delete elementn"); scanf("%d", &position); if ( position >= n+1 ) printf("Deletion not possible.n"); else { for ( c = position - 1 ; c < n - 1 ; c++ ) array[c] = array[c+1]; Performed Delete item from an array printf("Resultant array isn"); for( c = 0 ; c < n - 1 ; c++ ) printf("%dn", array[c]); } } 4.6 Exit exit (0); 5. User guide with Sample Input Output Screens Page 22 of 44
  • 23. Introduction to C ProgrammingCE00312-1 Individual Assignment Page 23 of 44
  • 24. Introduction to C ProgrammingCE00312-1 Individual Assignment Page 24 of 44
  • 25. Introduction to C ProgrammingCE00312-1 Individual Assignment Page 25 of 44
  • 26. Introduction to C ProgrammingCE00312-1 Individual Assignment Page 26 of 44
  • 27. Introduction to C ProgrammingCE00312-1 Individual Assignment 6. Limitations and Future Enhancements Like there are two faces of a coin so do our project has some of the limitation which makes it non-functional in some cases. Following are some of the limitations of the program and future enhancement – I. No graphical user interface - The program does not provide any kind of graphical user interface as it is a console application which may make it difficult to navigate for the user with little knowledge of computers. It may also take lots of time for the user to use the program as the user has to go through each and every message and texts written in the program unlike the graphical system which provides the graphical images in replace of bulk text messages. For the further enhancement the program can be made by choosing the windows application format which provides the graphical user interface to the users making it easy to navigate. II. No option to save results - There is no way to store the results for future use and access them whenever required. Once the work is done the results will be flushed out and system will come back to its previous position. For the further enhancement the program can make a use of file handling so that results would be stored for future access. 7. Test PlanAND RESULT In general, testing is finding out how well something works. In terms of human beings, testing tells what level of knowledge or skill has been acquired. In computer hardware and software development, testing is used at key checkpoints in the overall process to determine whether objectives are being met. For example, in software development, product objectives are sometimes tested by product user representatives. When the design is complete, coding follows and the finished code is then tested at the unit PERFORMANCE MANAGEMENT or module level by each programmer; at the component level by the group of programmers involved; and at the system level when all components are combined together. At early or late stages, a product or service may also be tested for usability. At the system level, the manufacturer or independent reviewer may subject a product or service to one or more performance tests, possibly using one or more benchmarks. Whether viewed as a product or a service or both, an application can also be tested in various ways by observing user experiences, by asking questions of users, by timing the flow through specific usage scenarios, and by comparing it with other application. Page 27 of 44
  • 28. Introduction to C ProgrammingCE00312-1 Question No: 1.Pyramid of asterisks Individual Assignment Input 6 2.Pyramid numbers of of * ** *** **** ***** ****** 6 3. Square asterisks Output 6 Status Tested By: Successful 654321 65432 6543 654 65 6 ****** ****** ****** ****** ****** ****** User Successful User Successful User 4. Series of Armstrong numbers between 1 and 500 1 153 370 371 407 Successful User 5.Fibonacci series from 1 to 100 using recursion User 6. Series of prime numbers from 1 to 100. 1 Successful 1 2 3 5 8 13 21 34 55 89 2,3,5,7,11,13,17,19,23, Successful 29,31,37,41,43,47,53,59, 61,67,71,73,79,83,89,97. Enter and Display Employee Information Employee 1 Employee code:101 Employee Name: ABC Department: HR Successful User 7. Employee 2 Page 28 of 44 User
  • 29. Introduction to C ProgrammingCE00312-1 Individual Assignment Employee code:102 Employee Name: XYZ Department: IT 9.Factorial of a number using while loop 4 Employee 3 Employee code:103 Employee Name: DEF Department: Accountant Student name: ABC Student number:12 Student marks:80 Grade: “A” 24 10.Sum of first and fifth digit of a 5 digit number 12345 11. Find out whether a 5 digit number is palindrome or not 8. Find Grade for a student Successful User Successful User 6 Successful User 12321 Number is palindrome Successful User 12.Count number of vowels in the sentence Working Number of vowels in “working”=2 Successful User 13. Copy the contents of an array into another Enter the value of array1=1 Destination array = 3 2 1 Successful User Item to be deleted from array = 3 1 Successful User Number of constants in “working”=5 Enter the value of array2=2 Enter the value of array3=3 14. Delete item from an array 1 2 3 Page 29 of 44
  • 30. Introduction to C ProgrammingCE00312-1 4 5 15. Exit 6 Individual Assignment 2 4 5 Exit – Out of the system Successful User 8. Conclusion I started this project when I had very few concepts about the C language and its different usage. During the project preparation Iwas introduced with the new concepts and new elements of C language along with the progression of the course. I was able to apply all those theoretical C concepts taught to me in my application to make it more and more functional. As the time passed by I worked on my project to make it very Compaq and very much functional and easy to use for the user. During this period I learned various C programming concepts and now in position to design in the error free program successfully. I came to know the various C programming techniques. I learned to make the variables and constants either global or local.I also learned the practical way of implementing the structures in the program and access the members of structures, compare them, initialize them and so on. The implementation of techniques like string comparison, function calling, recursion, array storage, and calling by value or reference, has broaden my knowledge regarding C language. The major technical learning I had from the project is that how different functions can be associated to form the single program and how the data flows from one unit (function) to another and produce the desired output. I was introduced with the validations techniques to make the program error free and reliable. Ihad also learned to design the problem, develop the algorithms, and test the program to measure the efficiency and accuracy. Page 30 of 44
  • 31. Introduction to C ProgrammingCE00312-1 Individual Assignment 9. References Books I. II. III. IV. V. Robert"C Programming Functions." C Programming Functions. Programiz, n.d. Web. 09 Nov. 2013. Code Coding. "C Program to Print Pyramid." Cprogramtocom. WordPress.,n.d. Web. 09 Nov. 2013. AbhasTandon. "C Program to Print All Prime Numbers between 1 and 100." - C WithAbhas. Cwithabhas, n.d. Web. 09 Nov. 2013. Dietel, P. & Dietel H. (2010).C How to program, New Delhi, Prentice Hall of India (PHI). Vol 6, pp.1-437 Donald, K. (2001).The Art of Computer Programming, Kansas City, AddisonWesleyPublication vol. 1. Electronic I. Available at : http://www.cembedded.com/2009/04/write-pseudocode-to-compare-versions.html [Last Accessed: 12 September 2013] II. Available at : http://www.dreamincode.net/forums/topic/10300-pseudocode-help/ [Last Accessed: 1 October 2013] III. Available at : http://www.fredosaurus.com/notes-cpp/algorithms/sorting/bubblesort-fixed.html [Last Accessed: 15 September 2013] IV. Available at http://www.metalshell.com/source_code/32/Simple_Struct_Example.html [Last Accessed: 19 September 2013] V. Available at http://qa.techinterviews.com/q/20060729010733AA7wpXo [Last Accessed: 25 September 2013] VI. Available at http://www.unf.edu/~broggio/cop3530/3530pseu.htm [Last Accessed: 21 September 2013] Page 31 of 44
  • 32. Introduction to C ProgrammingCE00312-1 Individual Assignment 10. Appendix Program: #include<stdio.h> #include<stdlib.h> #include<conio.h> #include<string.h> void menu() { clrscr(); printf("n Main Menu"); printf("n 1. Create Pattern "); printf("n 2. Print Series"); printf("n 3. Work with Records"); printf("n 4. Use Numeric Functions"); printf("n 5. Work with arrays"); printf("n 6. Exit"); } struct Emp { intempCode; charempName[50]; charempDept[20]; }; /* ====1.1 Creat Pattern for pyramid of asterisks==== */ void asterisk() { int n, c, k; printf("Enter number of rowsn"); scanf("%d",&n); for ( c = 1 ; c <= n ; c++ ) { Page 32 of 44
  • 33. Introduction to C ProgrammingCE00312-1 Individual Assignment for( k = 1 ; k <= c ; k++ ) printf("*"); printf("n"); } } /* ====1.2 Creat Pattern for pyramid of numbers==== */ voidpyramid_numbers() { intnum,r,c; printf("Enter any number: "); scanf("%d", &num); for(r=1; r<=num; r++) { for(c=num; c>=r; c--) printf("%d",c); printf("n"); } } /* ====1.3 Creat Pattern for square of asterisks==== */ voidsquare_asterisk() { intnum,r,c; printf("Enter loop repeat number(rows): "); scanf("%d",&num); for(r=1; num>=r; r++) { for(c=1; c<=num; c++) printf("*"); printf("n"); } } /* ====2.1 Print series of Armstrong numbers between 1 and 500==== */ Page 33 of 44
  • 34. Introduction to C ProgrammingCE00312-1 Individual Assignment void Armstrong() { inti,j,k,l,m,n; for (i=1;i<=500;i++) { j=i%10; k=i/10; l=k%10; m=k/10; n=(m*m*m)+(l*l*l)+(j*j*j); if (n==i) printf("%d n",i); } } /* ====2.2 Print series of Fibonacci series from 1 to 100 using recursion==== */ void Fibonacci() { intold_number; intcurrent_number; intnext_number; old_number = 1; current_number = 1; printf("1n"); while (current_number< 100) { printf("%dn", current_number); next_number = current_number + old_number; old_number = current_number; current_number = next_number; } } /* ====2.3 Print series of prime numbers from 1 to 100==== */ void prime() Page 34 of 44
  • 35. Introduction to C ProgrammingCE00312-1 Individual Assignment { intn,div,p; intnum=100; for(n=2; n<=num; n++) { for(div=2; div<n; div++) { if(n%div==0) { p=0; break; } p=1; } if(p) printf("t%d",n); } } /* ====3.1 Work with Records to Enter and Display Employee Information==== */ voidemp_information() { struct Emp e[3]; inti=1,j=1; char name[50],dept[20]; for(i=1;i<=3;++i) { printf("nn Employee : %d", i); printf("n Enter the Employee Code : "); scanf("%d",&e[i].empCode); printf("Enter the Employee Name : "); scanf("%s",&name); strcpy(e[i].empName,name); Page 35 of 44
  • 36. Introduction to C ProgrammingCE00312-1 printf("Enter the Department Individual Assignment : "); scanf("%s",&dept); strcpy(e[i].empDept,dept); } printf("nnn Employee Details "); for(j=1;j<=3;++j) { printf("nn Employee : %d",j); printf("n Employee Code : %d",e[j].empCode); printf("n Employee Name : %s",e[j].empName); printf("n Department : %s",e[j].empDept); } } /* ====3.2 Work with Records to Find Grade for a student==== */ voidgrade_student() { char name[50]; introll,marks; printf("Enter student name:-- "); scanf("%s",&name); printf("Enter roll number of student:-- "); scanf("%d",&roll); printf("Enter total marks of student:-- "); scanf("%d",&marks); printf("nName of student is:-- %s",name); printf("nRoll number is:-- %d",roll); if(marks>=70) printf("nYour Grade is A"); else if(marks>=60 && marks<=69) printf("nYour Grade is B"); else if(marks>=50 && marks<=59) printf("nYour Grade is C"); Page 36 of 44
  • 37. Introduction to C ProgrammingCE00312-1 Individual Assignment else if(marks<50) printf("nYour Grade is D"); else printf("n Kindly enter a valid marks"); } /* ====4.1 Use Numeric Functions for Factorial of a number using while loop ==== */ void factorial() { unsigned long longint f; inta,i; printf("nEnter a number: "); scanf("%d",&a); if(a<0) { printf("nPlease enter a positive number"); factorial(); } else { f=1; i=1; while(i<=a) { f = f * i; i++; } printf("Factorial: %lu",f); } } /* ====4.2 Use Numeric Functions for Sum of first and fifth digit of a 5 digit number ==== */ voidsum_of_first_to_fifth() Page 37 of 44
  • 38. Introduction to C ProgrammingCE00312-1 Individual Assignment { int number, last_digit, first_digit, total; printf (" Enter a five digit numeber: "); scanf ("%d", &number); last_digit = number % 10; total = last_digit; first_digit = (number / 10000) % 10; total = total + first_digit; printf ("The total of the first and the last digit of the entered number is: %d", total); } /* ====4.3 Use Numeric Functions to Find out whether a 5 digit number is palindrome or not==== */ voidpalindrom() { intnum,rem,i,rev=0,num1,count=0; printf("Enter the five digit number:n"); scanf("%d",&num); num1=num; while(num>0) { rem=num%10; rev=rem+rev*10; num=num/10; count++; } if(count==5) { if(num1==rev) { printf("The Given Number %d is Palindrome",num1); } else Page 38 of 44
  • 39. Introduction to C ProgrammingCE00312-1 Individual Assignment { printf("The Given Number %d is NOT Palindrome",num1); } } else { printf("The given %d number is not a five digit number!",num1); } } /* ====5.1 Work with Arrays to Count number of vowels in the sentence==== */ voidcount_vowel() { char sentence[80]; inti, vowels = 0, consonants = 0, special = 0; printf("Enter a word n"); scanf("%s",&sentence); for (i = 0; sentence[i] != '0'; i++) { if ((sentence[i] == 'a' || sentence[i] == 'e' || sentence[i] == 'i' || sentence[i] == 'o' || sentence[i] == 'u') || (sentence[i] == 'A' || sentence[i] == 'E' || sentence[i] == 'I' || sentence[i] == 'O' || sentence[i] == 'U')) { vowels = vowels + 1; } else { consonants = consonants + 1; } if (sentence[i] =='t' ||sentence[i] =='0' || sentence[i] ==' ') { Page 39 of 44
  • 40. Introduction to C ProgrammingCE00312-1 Individual Assignment special = special + 1; } } consonants = consonants - special; printf("No. of vowels in %s = %dn", sentence, vowels); printf("No. of consonants in %s = %dn", sentence, consonants); getch(); } /* ====5.2 Work with Arrays to Copy the contents of an array into another==== */ voidcopy_array() { int source[100], dest[100],i,j,no; clrscr(); printf("Enter the number of values to be enterd: "); scanf("%d",&no); for(i=0;i<no;i++){ printf("Enter the value of array no. %d :",i+1); scanf("%d",&source[i]); } for(i=0,j=no-1;i<no;i++,j--){ dest[j]=source[i]; } printf("Destination array:n"); for(i=0;i<no;i++){ printf("%dt",dest[i]); } } /* ====5.3 Work with Arrays to Delete item from an array==== */ voiddelete_array() { int array[100], position, c, n; Page 40 of 44
  • 41. Introduction to C ProgrammingCE00312-1 Individual Assignment printf("Enter number of elements in arrayn"); scanf("%d", &n); printf("Enter %d elementsn", n); for ( c = 0 ; c < n ; c++ ) scanf("%d", &array[c]); printf("Enter the location where you wish to delete elementn"); scanf("%d", &position); if ( position >= n+1 ) printf("Deletion not possible.n"); else { for ( c = position - 1 ; c < n - 1 ; c++ ) array[c] = array[c+1]; printf("Resultant array isn"); for( c = 0 ; c < n - 1 ; c++ ) printf("%dn", array[c]); } } void main() { intch; charans; menu: do{ clrscr(); menu(); printf("n ENTER CHOICE ...."); scanf("%d",&ch); switch(ch) { case 1: clrscr(); Page 41 of 44
  • 42. Introduction to C ProgrammingCE00312-1 Individual Assignment printf("tt ******** CREATE PATTERN ********"); printf("n1. Pyramid of asterisks "); printf("n2. Pyramid of numbers"); printf("n3. Square of asterisks"); printf("nn Enter choice..."); scanf("%d",&ch); switch(ch) { case 1: asterisk(); break; case 2: pyramid_numbers(); break; case 3: square_asterisk(); break; default: printf("Wrong choicenn"); goto menu; } break; case 2: clrscr(); printf("nntt ******** PRINT SERIES *******"); printf("n1. Series of Armstrong numbers between 1 and 500 "); printf("n2. Fibonacci series from 1 to 100 using recursion"); printf("n3. Series of prime numbers from 1 to 100"); printf("nnEnter your choice....."); scanf("%d",&ch); switch(ch) { case 1: Armstrong(); break; case 2: Fibonacci(); break; case 3: prime(); break; default: printf("Wrong choicenn"); goto menu; } break; Page 42 of 44
  • 43. Introduction to C ProgrammingCE00312-1 Individual Assignment case 3: clrscr(); printf("nntt ******* WORK WITH RECORDS *******"); printf("n1. Enter and Display Employee Information "); printf("n2. Find Grade for a student"); printf("nnEnter your choice....."); scanf("%d",&ch); switch(ch) { case 1: emp_information(); break; case 2: grade_student(); break; default: printf("Wrong choicenn"); goto menu; } break; case 4: clrscr(); printf("nntt ******* USE NUMERIC FUNCTION *******"); printf("n1. Factorial of a number using while loop "); printf("n2. Sum of first and fifth digit of a 5 digit number."); printf("n3. Find out whether a 5 digit number is palindrome or not."); printf("nnEnter your choice....."); scanf("%d",&ch); switch(ch) { case 1: factorial(); break; case 2: sum_of_first_to_fifth(); break; case 3: palindrom(); break; default: printf("Wrong choicenn"); goto menu; } break; Page 43 of 44
  • 44. Introduction to C ProgrammingCE00312-1 Individual Assignment case 5: clrscr(); printf("nntt ******** WORK WITH ARRAYS ********"); printf("n1. Count number of vowels in the sentence"); printf("n2. Copy the contents of an array into another."); printf("n3. Delete item from an array."); printf("nnEnter your choice....."); scanf("%d",&ch); switch(ch) { case 1: count_vowel(); break; case 2: copy_array(); break; case 3: delete_array(); break; default: printf("Wrong choicenn"); goto menu; } break; case 6: printf("nn Thanks"); printf("nn See you again"); exit (0); default: goto menu; } printf("nnPress y to continuee...."); scanf("%s",&ans); } while(ans=='y'||ans=='Y'); getch(); } Page 44 of 44