LABORATORY MANUAL. (CSE-103F) FCPC Lab

Size: px
Start display at page:

Download "LABORATORY MANUAL. (CSE-103F) FCPC Lab"

Transcription

1 LABORATORY MANUAL (CSE-103F) FCPC Lab Department of Computer Science & Engineering BRCM College of Engineering & Technology Bahal, Haryana

2 Aim: Main aim of this course is to understand and solve logical & mathematical problems through C language and Flowchart. Strengthen knowledge of a procedural programming language. Design and develop solutions to intermediate level problems using the C language. Further develop your skills in software development using a procedural language. Objectives: The C language is a simple computer language designed to enable sophisticated object-oriented programming. C is defined as a small but powerful set of extensions to the standard ANSI C language. Its additions to C are mostly based on Smalltalk, one of the first object-oriented programming languages. C is designed to give C full object-oriented programming capabilities, and to do so in a simple and straightforward way. Most object-oriented development environments consist of several parts: An object-oriented programming language A library of objects A suite of development tools A runtime environment

3 DESCRIPTION OF SCHEDULE: S.No List of Experiments 1. Introduction of Turbo C IDE and Programming Environment. 2. Write a program to find the largest of three numbers. (if-then-else) 3. Write a program to find the largest of ten numbers (for-statement) 4. Write a program to find the average mail height & average female heights in the class (input is in the form of sex code, height). 5. Write a program to find roots of a quadratic equation using functions and switch statements. 6. Write a program using arrays to find the largest and second largest numbers out of given 50 numbers. 7. Write a program to multiply two matrices. 8. Write a program to read a string and write it in reverse order. 9. Write a program to concatenate two strings of different lengths. 10 Write a program to check that the input string is a palindrome or not. 11. Programs on file handling. Lab No. 01

4 OBJECTIVE: Introduction of Turbo C IDE and Programming Environment THEORY The Development Environment - Integrated Development Environment (IDE): The Turbo C compiler has its own built-in text editor. The files you create with text editor are called source files, and for C++ they typically are named with the extension.cpp,.cp, or.c. The C Developing Environment, also called as Programmer s Platform, is a screen display with windows and pull-down menus. The program listing, error messages and other information are displayed in separate windows. The menus may be used to invoke all the operations necessary to develop the program, including editing, compiling, linking, and debugging and program execution. Invoking the IDE To invoke the IDE from the windows you need to double click the TC icon in the directory c:\tc\bin. The alternate approach is that we can make a shortcut of tc.exe on the desktop. This makes you enter the IDE interface, which initially displays only a menu bar at the top of the screen and a status line below will appear. The menu bar displays the menu names and the status line tells what various function keys will do. Default Directory The default directory of Turbo C compiler is c:\tc\bin.

5 Using Menus If the menu bar is inactive, it may be invoked by pressing the [F10] function key. To select different menu, move the highlight left or right with cursor (arrow) keys. You can also revoke the selection by pressing the key combination for the specific menu. Opening New Window To type a program, you need to open an Edit Window. For this, open file menu and click new. A window will appear on the screen where the program may be typed.

6 Writing a Program When the Edit window is active, the program may be typed. Use the certain key combinations to perform specific edit functions. Saving a Program To save the program, select save command from the file menu. This function can also be performed by pressing the [F2] button. A dialog box will appear asking for the path and name of the file. Provide an appropriate and unique file name. You can save the program after compiling too but saving it before compilation is more appropriate. Making an Executable File The source file is required to be turned into an executable file. This is called Making of the.exe file. The steps required to create an executable file are: 1. Create a source file, with a.c extension. 2. Compile the source code into a file with the.obj extension. 3. Link your.obj file with any needed libraries to produce an executable program. All the above steps can be done by using Run option from the menu bar or using key combination Ctrl+F9 (By this linking & compiling is done in one step).

7 Compiling the Source Code Although the source code in your file is somewhat cryptic, and anyone who doesn't know C will struggle to understand what it is for, it is still in what we call humanreadable form. But, for the computer to understand this source code, it must be converted into machine-readable form. This is done by using a compiler. Hence, compiling is the process in which source code is translated into machine understandable language. It can be done by selecting Compile option from menu bar or using key combination Alt+F9. Creating an Executable File with the Linker After your source code is compiled, an object file is produced. This file is often named with the extension.obj. This is still not an executable program, however. To turn this into an executable program, you must run your linker. C programs are typically created by linking together one or more OBJ files with one or more libraries. A library is a collection of linkable files that were supplied with your compiler. Compiling and linking in the IDE In the Turbo C IDE, compiling and linking can be performed together in one step. There are two ways to do this: you can select Make EXE from the compile menu, or you can press the [F9] key. Executing a Program If the program is compiled and linked without errors, the program is executed by selecting Run from the Run Menu or by pressing the [Ctrl+F9] key combination. The Development Cycle If every program worked the first time you tried it that would be the complete development cycle: Write the program, compile the source code, link the program, and run it. Unfortunately, almost every program, no matter how trivial, can and will have errors, or bugs, in the program. Some bugs will cause the compile to fail, some will cause the link to fail, and some will only show up when you run the program.

8 Whatever type of bug you find, you must fix it, and that involves editing your source code, recompiling and relinking, and then rerunning the program. Correcting Errors If the compiler recognizes some error, it will let you know through the Compiler window. You ll see that the number of errors is not listed as 0, and the word Error appears instead of the word Success at the bottom of the window. The errors are to be removed by returning to the edit window. Usually these errors are a result of a typing mistake. The compiler will not only tell you what you did wrong; they ll point you to the exact place in your code where you made the mistake. Exiting IDE An Edit window may be closed in a number of different ways. You can click on the small square in the upper left corner, you can select close from the window menu, or you can press the [Alt][F3] combination. To exit from the IDE, select [Alt][X] Combination. EXERCISE Exit from the File Menu or press 1. Type the following program in C Editor and execute it. Mention the Error. void main(void) printf( This is my first program in C );

9 Lab No. 02 OBJECTIVE: Write a program to find the largest of three numbers. (if-then-else) #include<stdio.h> #include<conio.h> void main( ) float a,b,c; printf( Enter any three numbers: ); scanf( %f%f%f,&a,&b,&c); if((a>b)&&(a>c)) printf( Largest of three numbers: %f,a); else if((b>a)&&(b>c)) printf( Largest of three numbers: %f,b); else printf( Largest of three numbers: %f,c); getch( );

10 Lab No. 03 OBJECTIVE: Write a program to find the largest of ten numbers (for-statement) #include<stdio.h> #include<conio.h> void main() int a[10],i,s=0,j,t; clrscr(); printf( Enter ten numbers: ); for(i=0;i<10;i++) scanf("%d",&a[i]); for(i=0;i<10;i++) for(j=i+1;j<10;j++) if(a[i]>a[j]) t=1; else t=0; break; if(t==1) printf("\nlargest no.:%d",a[i]); break; getch();

11 Lab No. 04 OBJECTIVE: Write a program to find the average mail height & average female heights in the class (input is in the form of sex code, height). #include<stdio.h> #include<conio.h> void main() int mh[5],fh[5],i; float mavg,favg,msum=0,fsum=0; clrscr(); printf( enter the height of male\n ); for(i=0;i<5;i++) scanf( %d,&mh[i]); msum=msum+mh[i]; mavg=msum/5; printf( enter the height of female\n ); for(i=0;i<5;i++) scanf( %d,&fh[i]); fsum=fsum+fh[i]; favg=fsum/5; printf( the average of male height is %f \n,mavg); printf( the average of female height is %f \n,favg); getch();

12 Lab No. 05 OBJECTIVE: Write a program to find roots of a quadratic equation using switch statements. #include<stdio.h> #include<conio.h> #include<math.h> main() float a,b,c,d,x1,x2; int ch; clrscr(); printf("enter a,b,c values"); scanf("%f%f%f",&a,&b,&c); d=pow(b,2)-4*a*c; if(d==0) ch=1; else if(d>0) ch=2; else ch=3; printf("a=%6.2f\nb=%6.2f\nc=%6.2f\n",a,b,c); printf("discriminate D=%6.2f\n",d); switch(ch) case 1: printf("equal Roots"); x1=x2=-b/(2*a); printf("x1=x2=%6.2f\n",x1); break; case 2: printf("roots are Real and inequal"); x1=(-b+sqrt(d))/(2*a); x2=(-b-sqrt(d))/(2*a); printf("x1=%6.2f\n",x1); printf("x2=%6.2f\n",x2);

13 break; case 3: printf("imaginary roots \n"); printf("x1=%6.2f+i%6.2f\n",-b/(2*a), sqrt(-d)/(2*a)); printf("x2=%6.2f-i%6.2f\n",-b/(2*a), sqrt(-d)/(2*a)); break; getch();

14 Lab No. 6 OBJECTIVE: Write a program using arrays to find the largest and second largest numbers out of given 50 numbers. #include<stdio.h> #include<conio.h> void main() int i,a[55],n,l=0,sl; clrscr(); printf("how many no. will you enter: "); scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); l=a[1]; for(i=0;i<n;i++) if(a[i]>l) l=a[i]; printf("largest element is:%d",l); sl=a[1]; for(i=0;i<n;i++) if(a[i]>sl) sl=a[i]; printf("second Largest element is:%d",sl); getch();

15 Lab No. 7 OBJECTIVE: Write a program to multiply two matrices. #include<stdio.h> #include<conio.h> #include<process.h> void main() int a[10][10],b[10][10],c[10][10]; int i,j,m,n,p,q,s; clrscr(); printf("input row and column of matrix-a\n"); scanf("%d%d",&m,&n); printf("input row and column of matrix-b\n"); scanf("%d%d",&p,&q); if(n!=p) printf("matrix cannot be multiplied\n"); getch(); exit(0); printf("input Matrix-A\n"); for(i=0;i<m;i++) for(j=0;j<n;j++) scanf("%d",&a[i][j]); printf("input Matrix-B\n"); for(i=0;i<p;i++) for(j=0;j<q;j++) scanf("%d",&b[i][j]);

16 c[i][j]=0; for(s=0;s<n;s++) c[i][j]=c[i][j]+a[i][s]*b[s][j]; printf("\nproduct of matrix A and matrix B is:\n"); for(i=0;i<m;i++) for(j=0;j<q;j++) printf("\t%d",c[i][j]); printf("\n"); getch();

17 Lab No. 8 OBJECTIVE: Write a program to read a string and write it in reverse order. #include<stdio.h> #include<conio.h> void main() char a[20],i, b[20],g=0,j; clrscr(); printf("enter any string: "); scanf("%s",a); for(i=0;a[i]!='\0';i++) g++; j=g-1; for(i=0;i<g;i++) b[j]=a[i]; j--; printf("reverse order of string: %s",b); getch();

18 Lab No. 9 OBJECTIVE: Write a program to concatenate two strings of different lengths. #include<stdio.h> #include<conio.h> void main() char a[25],b[25],c[25]; int i.j; clrscr(); printf( Enter first string: ); scanf( %s,a); printf( Enter second string: ); scanf( %s,b); for(i=0;a[i]!= \0 ;i++) c[i]=a[i]; for(j=0; b[j]!= \0 ; j++) c[i+j]=b[j]; c[i+j]= \0 ; printf( The concatenated string is:\n%s,c ); getch();

19 Lab No. 10 OBJECTIVE: Write a program to check that the input string is a palindrome or not. #include<stdio.h> #include<conio.h> #include<process.h> void main() char a[ 20],i,b[20],g=0,j,m; clrscr(); printf("enter any string: "); scanf("%s",a); for(i=0;a[i]!='\0';i++) g++; j=g-1; for(i=0;i<g;i++) b[j]=a[i]; j--; for(i=0;i<g;i++) if(b[i]==a[i]) m=0; else

20 m=1; break; if(m==0) printf("string is a Palindrome"); else if(m==1) printf("string is not a Palindrome");

21 Lab No. 11 OBJECTIVE: Programs on file handling, which copies one file to another Program: #include<stdio.h> #include<string.h> #include<dos.h> #include<conio.h> #define L 80 main(int argc, char *argv[]) FILE *sfpt,*dfpt; char c; char sfname[l],dfname[l]; clrscr(); if(argc!=3) printf("invalid No of parameters."); exit(1); strcpy(sfname,argv[1]); strcpy(dfname,argv[2]); sfpt=fopen(sfname,"r"); if(sfpt==null) printf("file can't be opend %s",sfname); else dfpt=fopen(dfname,"w"); if(dfpt==null) printf("file can't be found: %s",sfname); else while(!feof(sfpt))

22 fclose(sfpt); fclose(dfpt); getch(); c=getc(sfpt); putc(c,dfpt);

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE 1. Write a C program to perform addition, subtraction, multiplication and division of two numbers. # include # include int a, b,sum,

More information

Tutorial No. 2 - Solution (Overview of C)

Tutorial No. 2 - Solution (Overview of C) Tutorial No. 2 - Solution (Overview of C) Computer Programming and Utilization (2110003) 1. Explain the C program development life cycle using flowchart in detail. OR Explain the process of compiling and

More information

Programming I Laboratory - lesson 01

Programming I Laboratory - lesson 01 Programming I Laboratory - lesson 0 Introduction in C++ programming environment. The C++ program structure. Computer programs are composed of instructions and data. Instructions tell the computer to do

More information

Unit 3 Decision making, Looping and Arrays

Unit 3 Decision making, Looping and Arrays Unit 3 Decision making, Looping and Arrays Decision Making During programming, we have a number of situations where we may have to change the order of execution of statements based on certain conditions.

More information

Programming in C Lab

Programming in C Lab Programming in C Lab 1a. Write a program to find biggest number among given 3 numbers. ALGORITHM Step 1 : Start Start 2 : Input a, b, c Start 3 : if a > b goto step 4, otherwise goto step 5 Start 4 : if

More information

/* Area and circumference of a circle */ /*celsius to fahrenheit*/

/* Area and circumference of a circle */ /*celsius to fahrenheit*/ /* Area and circumference of a circle */ #include #include #define pi 3.14 int radius; float area, circum; printf("\nenter radius of the circle : "); scanf("%d",&radius); area = pi

More information

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities Continuous Internal Evaluation Test 2 Date: 0-10- 2017 Marks: 0 Subject &

More information

Lab Manual B.Tech 1 st Year

Lab Manual B.Tech 1 st Year Lab Manual B.Tech 1 st Year Fundamentals & Computer Programming Lab Dev Bhoomi Institute of Technology Dehradun www.dbit.ac.in Affiliated to Uttrakhand Technical University, Dehradun www.uktech.in CONTENTS

More information

Arrays. Arrays are of 3 types One dimensional array Two dimensional array Multidimensional array

Arrays. Arrays are of 3 types One dimensional array Two dimensional array Multidimensional array Arrays Array is a collection of similar data types sharing same name or Array is a collection of related data items. Array is a derived data type. Char, float, int etc are fundamental data types used in

More information

Developed By: P.Venkateshwarlu, Alphores Womens Degree College, Karimnagar

Developed By: P.Venkateshwarlu, Alphores Womens Degree College, Karimnagar B.Sc (Computer Science) 1 sem Practical Solutions 1.Program to find biggest in 3 numbers using conditional operators. # include # include int a, b, c, big ; printf("enter three numbers

More information

1) Write a C Program to check whether given year is Leap year or not. AIM: A C Program to check whether given year is Leap year or not.

1) Write a C Program to check whether given year is Leap year or not. AIM: A C Program to check whether given year is Leap year or not. 1) Write a C Program to check whether given year is Leap year or not. AIM: A C Program to check whether given year is Leap year or not. #include int year; printf("enter a year:"); scanf("%d",&year);

More information

F.E. Sem. II. Structured Programming Approach

F.E. Sem. II. Structured Programming Approach F.E. Sem. II Structured Programming Approach Time : 3 Hrs.] Mumbai University Examination Paper Solution - May 14 [Marks : 80 Q.1(a) What do you mean by algorithm? Which points you should consider [4]

More information

PROGRAMMING WITH C-LANGUAGE (EL-255) For S.E(EL)

PROGRAMMING WITH C-LANGUAGE (EL-255) For S.E(EL) PRACTICAL WORK BOOK For Academic Session 2012 PROGRAMMING WITH C-LANGUAGE (EL-255) For S.E(EL) Name: Roll Number: Batch: Department: Year: Department of Electronic Engineering N.E.D. University of Engineering

More information

International Journal of Mathematics & Computing. Research Article

International Journal of Mathematics & Computing. Research Article www.advancejournals.org Open Access Scientific Publisher Research Article C/C++ PROGRAM: DETERMINATION OF ENERGY BAND GAP FROM UV-VISIBLE SPECTROGRAPH RESULTS ABSTRACT Rajivgandhi S 1, Dinesh Kumar A 2,

More information

C PROGRAMMING. Prof. (Dr.) S. N. Mishra (Prof. & Head, Dept. of CSEA, IGIT, Sarang)

C PROGRAMMING. Prof. (Dr.) S. N. Mishra (Prof. & Head, Dept. of CSEA, IGIT, Sarang) LAB MANUAL C MING Prof. (Dr.) S. N. Mishra (Prof. & Head, Dept. of CSEA, IGIT, Sarang) C MING LAB Experiment No. 1 Write a C program to find the sum of individual digits of a positive integer. Experiment

More information

-2017-18 1. a.. b. MS-Paint. Ex.No 1 Windows XP c. 23,, d. MS-Dos DIR /W /P /B /L. Windows Xp, MS-Paint, Dir ; 1. Properties 23 10111 23 27 23 17 2. Display Properties MS-Paint ok 1. Start All program

More information

Programming and Data Structures Mid-Semester - Solutions to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring

Programming and Data Structures Mid-Semester - Solutions to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring Programming and Data Structures Mid-Semester - s to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring 2015-16 February 15, 2016 1. Tick the correct options. (a) Consider the following

More information

Computers Programming Course 12. Iulian Năstac

Computers Programming Course 12. Iulian Năstac Computers Programming Course 12 Iulian Năstac Recap from previous course Strings in C The character string is one of the most widely used applications that involves vectors. A string in C is an array of

More information

Numerical Method (2068 Third Batch)

Numerical Method (2068 Third Batch) 1. Define the types of error in numerical calculation. Derive the formula for secant method and illustrate the method by figure. There are different types of error in numerical calculation. Some of them

More information

BCSE1002: Computer Programming and Problem Solving LAB MANUAL

BCSE1002: Computer Programming and Problem Solving LAB MANUAL LABMANUAL BCSE1002: Computer Programming and Problem Solving LAB MANUAL L T P Course Type Semester Offered Academic Year 2018-2019 Slot Class Room Faculty Details: Name Website link Designation School

More information

PESIT Bangalore South Campus Hosur Road (1km before Electronic City), Bengaluru Department of Basic Science and Humanities

PESIT Bangalore South Campus Hosur Road (1km before Electronic City), Bengaluru Department of Basic Science and Humanities SOLUTION OF CONTINUOUS INTERNAL EVALUATION TEST -1 Date : 27-02 2018 Marks:60 Subject & Code : Programming in C and Data Structures- 17PCD23 Name of faculty : Dr. J Surya Prasad/Mr. Naushad Basha Saudagar

More information

P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS)

P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) FACULTY: Ms. Saritha P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) SUBJECT / CODE: Programming in C and Data Structures- 15PCD13 What is token?

More information

Unit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array?

Unit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array? 1 What is an array? Explain with Example. What are the advantages of using an array? An array is a fixed-size sequenced collection of elements of the same data type. An array is derived data type. The

More information

Subject: Fundamental of Computer Programming 2068

Subject: Fundamental of Computer Programming 2068 Subject: Fundamental of Computer Programming 2068 1 Write an algorithm and flowchart to determine whether a given integer is odd or even and explain it. Algorithm Step 1: Start Step 2: Read a Step 3: Find

More information

Q 1. Attempt any TEN of the following:

Q 1. Attempt any TEN of the following: Subject Code: 17212 Model Answer Page No: 1 / 26 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The

More information

DEV BHOOMI INSTITUTE OF TECHNOLOGY

DEV BHOOMI INSTITUTE OF TECHNOLOGY DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering Year: 1 st Semester:1 st C Programming Lab- LAB MANUAL INDEX S.No. Experiments Software Used 1. To find the sum of individual

More information

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE

M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE M4.1-R3: PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be

More information

Object Oriented Programming Using C++ Mathematics & Computing IET, Katunayake

Object Oriented Programming Using C++ Mathematics & Computing IET, Katunayake Assigning Values // Example 2.3(Mathematical operations in C++) float a; cout > a; cout

More information

Program. SUBJECT: ACP (C - Programming) Array Program. // Find the minimum number from given N element. Prepared By : Dhaval R.

Program. SUBJECT: ACP (C - Programming) Array Program. // Find the minimum number from given N element. Prepared By : Dhaval R. Program // Find the minimum number from given N element. #include #include void main() int a[50],i,n,min; clrscr(); printf("\n Enter array size : "); scanf("%d",&n); printf("\n Enter

More information

WAP 10. WAP 11. WAP 12. WAP 13. WAP 14. WAP 15. WAP 16. WAP 1. : 17. WAP 18. WAP 19. WAP 20. WAP 21. WAP 22. WAP 23. WAP & 24. WAP

WAP 10. WAP 11. WAP 12. WAP 13. WAP 14. WAP 15. WAP 16. WAP 1. : 17. WAP 18. WAP 19. WAP 20. WAP 21. WAP 22. WAP 23. WAP & 24. WAP Contents 1. WAP to accept the value from the user and exchange the values.... 2 2. WAP to check whether the number is even or odd.... 2 3. WAP to Check Odd or Even Using Conditional Operator... 3 4. WAP

More information

LAB MANUAL LAB. Regulation : 2013 Branch. : B.E. All Branches Year & Semester : I Year / I Semester GE6161 COMPUTER PRACTICES

LAB MANUAL LAB. Regulation : 2013 Branch. : B.E. All Branches Year & Semester : I Year / I Semester GE6161 COMPUTER PRACTICES LAB MANUAL Regulation : 2013 Branch : B.E. All Branches Year & Semester : I Year / I Semester GE6161 COMPUTER PRACTICES LAB VVIT DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING 1 ANNA UNIVERSITY: CHENNAI

More information

Decision Making and Branching

Decision Making and Branching INTRODUCTION Decision Making and Branching Unit 4 In the previous lessons we have learned about the programming structure, data types, declaration of variables, tokens, constants, keywords and operators

More information

C library = Header files + Reserved words + main method

C library = Header files + Reserved words + main method DAY 1: What are Libraries and Header files in C. Suppose you need to see an Atlas of a country in your college. What do you need to do? You will first go to the Library of your college and then to the

More information

Classification s of Data Structures

Classification s of Data Structures Linear Data Structures using Sequential organization Classification s of Data Structures Types of Data Structures Arrays Declaration of arrays type arrayname [ arraysize ]; Ex-double balance[10]; Arrays

More information

1. Simple if statement. 2. if else statement. 3. Nested if else statement. 4. else if ladder 1. Simple if statement

1. Simple if statement. 2. if else statement. 3. Nested if else statement. 4. else if ladder 1. Simple if statement UNIT- II: Control Flow: Statements and Blocks, if, switch statements, Loops: while, do-while, for, break and continue, go to and Labels. Arrays and Strings: Introduction, One- dimensional arrays, Declaring

More information

Array Initialization

Array Initialization Array Initialization Array declarations can specify initializations for the elements of the array: int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 ; initializes primes[0] to 2, primes[1] to 3, primes[2]

More information

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 Code: DC-05 Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 NOTE: There are 11 Questions in all. Question 1 is compulsory and carries 16 marks. Answer to Q. 1. must be written in the space

More information

C Program. Output. Hi everyone. #include <stdio.h> main () { printf ( Hi everyone\n ); }

C Program. Output. Hi everyone. #include <stdio.h> main () { printf ( Hi everyone\n ); } C Program Output #include main () { printf ( Hi everyone\n ); Hi everyone #include main () { printf ( Hi everyone\n ); #include and main are Keywords (or Reserved Words) Reserved Words

More information

'C' Programming Language

'C' Programming Language F.Y. Diploma : Sem. II [DE/EJ/ET/EN/EX] 'C' Programming Language Time: 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1(a) Define pointer. Write syntax

More information

Computer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size];

Computer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size]; Arrays An array is a collection of two or more adjacent memory cells, called array elements. Array is derived data type that is used to represent collection of data items. C Array is a collection of data

More information

P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS DEPARTMENT OF SCIENCE AND HUMANITIES EVEN SEMESTER FEB 2017

P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS DEPARTMENT OF SCIENCE AND HUMANITIES EVEN SEMESTER FEB 2017 P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS DEPARTMENT OF SCIENCE AND HUMANITIES ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) EVEN SEMESTER FEB 07 FACULTY: Dr.J Surya Prasad/Ms. Saritha/Mr.

More information

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities INTERNAL ASSESSMENT TEST 1 SOLUTION PART 1 1 a Define algorithm. Write an algorithm to find sum and average of three numbers. 4 An Algorithm is a step by step procedure to solve a given problem in finite

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

Arrays in C. By Mrs. Manisha Kuveskar.

Arrays in C. By Mrs. Manisha Kuveskar. Arrays in C By Mrs. Manisha Kuveskar. C Programming Arrays An array is a collection of data that holds fixed number of values of same type. For example: if you want to store marks of 100 students, you

More information

7.STRINGS. Data Structure Management (330701) 1

7.STRINGS. Data Structure Management (330701)   1 Strings and their representation String is defined as a sequence of characters. 7.STRINGS In terms of c language string is an array of characters. While storing the string in character array the size of

More information

1. FIBONACCI SERIES. Write a C++ program to generate the Fibonacci for n terms. To write a C++ program to generate the Fibonacci for n terms.

1. FIBONACCI SERIES. Write a C++ program to generate the Fibonacci for n terms. To write a C++ program to generate the Fibonacci for n terms. PROBLEM: 1. FIBONACCI SERIES Write a C++ program to generate the Fibonacci for n terms. AIM: To write a C++ program to generate the Fibonacci for n terms. PROGRAM CODING: #include #include

More information

MAHALAKSHMI ENGINEERING COLLEGE B TIRUCHIRAPALLI

MAHALAKSHMI ENGINEERING COLLEGE B TIRUCHIRAPALLI MAHALAKSHMI ENGINEERING COLLEGE B TIRUCHIRAPALLI 621213 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Sub code: CS2203 SEM: III Sub Name: Object Oriented Programming Year: II UNIT-I PART-A 1. What is

More information

Worksheet 4 Basic Input functions and Mathematical Operators

Worksheet 4 Basic Input functions and Mathematical Operators Name: Student ID: Date: Worksheet 4 Basic Input functions and Mathematical Operators Objectives After completing this worksheet, you should be able to Use an input function in C Declare variables with

More information

Solution Set(Reference Book - Programming with c By Byron Gottfried Thrid Edition)

Solution Set(Reference Book - Programming with c By Byron Gottfried Thrid Edition) (2½ Hours) [Total Marks: 75 N. B.: (1) All questions are compulsory. (2) Make suitable assumptions wherever necessary and state the assumptions made. (3) Answers to the same question must be written together.

More information

FUNCTIONS OMPAL SINGH

FUNCTIONS OMPAL SINGH FUNCTIONS 1 INTRODUCTION C enables its programmers to break up a program into segments commonly known as functions, each of which can be written more or less independently of the others. Every function

More information

MODULE 2: Branching and Looping

MODULE 2: Branching and Looping MODULE 2: Branching and Looping I. Statements in C are of following types: 1. Simple statements: Statements that ends with semicolon 2. Compound statements: are also called as block. Statements written

More information

Saini Technologies ADVANCED C PROGRAMMING WITH SAINI TECHNOLOGIES. Sushil Kumar Saini Mo.

Saini Technologies ADVANCED C PROGRAMMING WITH SAINI TECHNOLOGIES. Sushil Kumar Saini   Mo. Saini Technologies ADVANCED C PROGRAMMING WITH SAINI TECHNOLOGIES Sushil Kumar Saini Email: Sushilsaini04@gmail.com Mo. 9896470047 Integer Array int a[]=12,34,54,45,34,34; printf("%d",a[0]); printf(" %d",a[1]);

More information

TEST BDA24202 / BTI10202 COMPUTER PROGRAMMING May 2013

TEST BDA24202 / BTI10202 COMPUTER PROGRAMMING May 2013 DEPARTMENT OF MATERIAL AND ENGINEERING DESIGN FACULTY OF MECHANICAL AND MANUFACTURING ENGINEERING UNIVERSITI TUN HUSSEIN ONN MALAYSIA (UTHM), JOHOR TEST BDA24202 / BTI10202 COMPUTER PROGRAMMING May 2013

More information

CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-1-0) Introduction to arrays

CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-1-0) Introduction to arrays CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-1-0) Introduction to arrays 1 What are Arrays? Arrays are our first example of structured data. Think of a book with pages numbered 1,2,...,400.

More information

2. First C. Algorithm

2. First C. Algorithm 2. First C 1 Algorithm Recipe to solve the problem A sequence of steps that leads from starting point to a finished product Only by following the algorithm, one can solve the problem, even if one( he,

More information

Worksheet 11 Multi Dimensional Array and String

Worksheet 11 Multi Dimensional Array and String Name: Student ID: Date: Worksheet 11 Multi Dimensional Array and String Objectives After completing this worksheet, you should be able to Declare multi dimensional array of elements and string variables

More information

Test Paper 1 Programming Language 1(a) What is a variable and value of a variable? A variable is an identifier and declared in a program which hold a value defined by its type e.g. integer, character etc.

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) Subject Code: 17212 Model Answer Page No: 1/28 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in themodel answer scheme. 2) The model

More information

F.E. Sem. II. Structured Programming Approach

F.E. Sem. II. Structured Programming Approach F.E. Sem. II Structured Programming Approach Time : 3 Hrs.] Mumbai University Examination Paper Solution - May 13 [Marks : 80 Q.1(a) Explain the purpose of following standard library functions : [3] (i)

More information

Unit 5. Decision Making and Looping. School of Science and Technology INTRODUCTION

Unit 5. Decision Making and Looping. School of Science and Technology INTRODUCTION INTRODUCTION Decision Making and Looping Unit 5 In the previous lessons we have learned about the programming structure, decision making procedure, how to write statements, as well as different types of

More information

Multiple Choice Questions ( 1 mark)

Multiple Choice Questions ( 1 mark) Multiple Choice Questions ( 1 mark) Unit-1 1. is a step by step approach to solve any problem.. a) Process b) Programming Language c) Algorithm d) Compiler 2. The process of walking through a program s

More information

UNIT 3 FUNCTIONS AND ARRAYS

UNIT 3 FUNCTIONS AND ARRAYS UNIT 3 FUNCTIONS AND ARRAYS Functions Function definitions and Prototypes Calling Functions Accessing functions Passing arguments to a function - Storage Classes Scope rules Arrays Defining an array processing

More information

Government Polytechnic Muzaffarpur.

Government Polytechnic Muzaffarpur. Government Polytechnic Muzaffarpur. Name of the Lab: COMPUTER PROGRAMMING LAB (MECH. ENGG. GROUP) Subject Code: 1625408 Experiment: 1 Aim: Programming exercise on executing a C program. If you are looking

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

PDS Lab Section 16 Autumn Tutorial 3. C Programming Constructs

PDS Lab Section 16 Autumn Tutorial 3. C Programming Constructs PDS Lab Section 16 Autumn-2017 Tutorial 3 C Programming Constructs This flowchart shows how to find the roots of a Quadratic equation Ax 2 +Bx+C = 0 Start Input A,B,C x B 2 4AC False x If 0 True B x 2A

More information

Pointers and scanf() Steven R. Bagley

Pointers and scanf() Steven R. Bagley Pointers and scanf() Steven R. Bagley Recap Programs are a series of statements Defined in functions Can call functions to alter program flow if statement can determine whether code gets run Loops can

More information

Test Paper 3 Programming Language Solution Question 1: Briefly describe the structure of a C program. A C program consists of (i) functions and (ii) statements There should be at least one function called

More information

SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I

SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I Year & Sem: I B.E (CSE) & II Date of Exam: 21/02/2015 Subject Code & Name: CS6202 & Programming & Data

More information

UNDERSTANDING THE COMPUTER S MEMORY

UNDERSTANDING THE COMPUTER S MEMORY POINTERS UNDERSTANDING THE COMPUTER S MEMORY Every computer has a primary memory. All our data and programs need to be placed in the primary memory for execution. The primary memory or RAM (Random Access

More information

What is recursion. WAP to find sum of n natural numbers using recursion (5)

What is recursion. WAP to find sum of n natural numbers using recursion (5) DEC 2014 Q1 a What is recursion. WAP to find sum of n natural numbers using recursion (5) Recursion is a phenomenon in which a function calls itself. A function which calls itself is called recursive function.

More information

CSE101-Lec#18. Multidimensional Arrays Application of arrays. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming

CSE101-Lec#18. Multidimensional Arrays Application of arrays. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming CSE101-Lec#18 Multidimensional Arrays Application of arrays Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU Outline Defining and processing 1D array 2D array Applications of arrays 1-D array A

More information

SOFTWARE TESTING LABORATORY. Subject Code: 10ISL68 I.A. Marks: 25 Hours/Week: 03 Exam Hours: 03 Total Hours: 42 Exam Marks: 50

SOFTWARE TESTING LABORATORY. Subject Code: 10ISL68 I.A. Marks: 25 Hours/Week: 03 Exam Hours: 03 Total Hours: 42 Exam Marks: 50 SOFTWARE TESTING LABORATORY Subject Code: 10ISL68 I.A. Marks: 25 Hours/Week: 03 Exam Hours: 03 Total Hours: 42 Exam Marks: 50 1. Design and develop a program in a language of your choice to solve the Triangle

More information

List of Programs: Programs: 1. Polynomial addition

List of Programs: Programs: 1. Polynomial addition List of Programs: 1. Polynomial addition 2. Common operations on vectors in c 3. Matrix operation: multiplication, transpose 4. Basic Unit conversion 5. Number conversion: Decimal to binary 6. Number conversion:

More information

THE BAPATLA ENGINEERING COLLEGE:: BAPATLA DEPARTMENT OF MCA. Subject name: C programing Lab. Subject code: MCA 107. LAB manual of c programing lab

THE BAPATLA ENGINEERING COLLEGE:: BAPATLA DEPARTMENT OF MCA. Subject name: C programing Lab. Subject code: MCA 107. LAB manual of c programing lab THE BAPATLA ENGINEERING COLLEGE:: BAPATLA DEPARTMENT OF MCA Subject name: C programing Lab Subject code: MCA 107 LAB manual of c programing lab 1. Write a C program for calculating compound interest. #include

More information

GE Computer Practices Lab

GE Computer Practices Lab GE6161 - Computer Practices Lab Manual ( First semester B.E/B.Tech. Students for the Academic Year 2015-16 ) VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANKULATHUR 603 203 Prepared by T. Rajasekaran,

More information

only in the space provided. Do the rough work in the space provided for it. The question paper has total 12 pages.

only in the space provided. Do the rough work in the space provided for it. The question paper has total 12 pages. Instructions: Answer all five questions. Total marks = 10 x 2 + 4 x 10 = 60. Time = 2hrs. Write your answer only in the space provided. Do the rough work in the space provided for it. The question paper

More information

Question Bank (SPA SEM II)

Question Bank (SPA SEM II) Question Bank (SPA SEM II) 1. Storage classes in C (Refer notes Page No 52) 2. Difference between function declaration and function definition (This question is solved in the note book). But solution is

More information

Contents. Sr. No. Title of the Practical: Page no Signature. Gate. OR gate. EX-OR gate. gate. identifying ODD and EVEN number.

Contents. Sr. No. Title of the Practical: Page no Signature. Gate. OR gate. EX-OR gate. gate. identifying ODD and EVEN number. Contents Sr. No. Title of the Practical: Page no Signature 01. To Design and train a perceptron for AND Gate. 02. To design and train a perceptron training for OR gate. 03. To design and train a perceptron

More information

Tribhuvan University Institute of Science and Technology 2065

Tribhuvan University Institute of Science and Technology 2065 1CSc.102-2065 2065 Candidates are required to give their answers in their own words as for as practicable. 1. Draw the flow chart for finding largest of three numbers and write an algorithm and explain

More information

UNIT III ARRAYS AND STRINGS

UNIT III ARRAYS AND STRINGS UNIT III ARRAYS AND STRINGS Arrays Initialization Declaration One dimensional and Two dimensional arrays. String- String operations String Arrays. Simple programs- sorting- searching matrix operations.

More information

Problem # 1. calculate the grade. Allow a student the next grade if he/she needs only 0.5 marks to obtain the next grade. Use else-if construction.

Problem # 1. calculate the grade. Allow a student the next grade if he/she needs only 0.5 marks to obtain the next grade. Use else-if construction. ME 172 Lecture 6 Problem # 1 Write a program to calculate the grade point average of a 3.00 credit hour course using the data obtained from the user. Data contains four items: attendance (30), class test

More information

Prepared by: Shraddha Modi

Prepared by: Shraddha Modi Prepared by: Shraddha Modi Introduction In looping, a sequence of statements are executed until some conditions for termination of the loop are satisfied. A program loop consist of two segments Body of

More information

UIC. C Programming Primer. Bharathidasan University

UIC. C Programming Primer. Bharathidasan University C Programming Primer UIC C Programming Primer Bharathidasan University Contents Getting Started 02 Basic Concepts. 02 Variables, Data types and Constants...03 Control Statements and Loops 05 Expressions

More information

Programming & Data Structure Laboratory. Day 2, July 24, 2014

Programming & Data Structure Laboratory. Day 2, July 24, 2014 Programming & Data Structure Laboratory Day 2, July 24, 2014 Loops Pre and post test loops for while do-while switch-case Pre-test loop and post-test loop Condition checking True Loop Body False Loop Body

More information

Computers Programming Course 7. Iulian Năstac

Computers Programming Course 7. Iulian Năstac Computers Programming Course 7 Iulian Năstac Recap from previous course Operators in C Programming languages typically support a set of operators, which differ in the calling of syntax and/or the argument

More information

AMCAT Automata Coding Sample Questions And Answers

AMCAT Automata Coding Sample Questions And Answers 1) Find the syntax error in the below code without modifying the logic. #include int main() float x = 1.1; switch (x) case 1: printf( Choice is 1 ); default: printf( Invalid choice ); return

More information

Fundamentals of Computer Programming Using C

Fundamentals of Computer Programming Using C CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vidyanagar Faculty Name: Ami D. Trivedi Class: FYBCA Subject: US01CBCA01 (Fundamentals of Computer Programming Using C) *UNIT 3 (Structured Programming, Library Functions

More information

The inverse of a matrix

The inverse of a matrix The inverse of a matrix A matrix that has an inverse is called invertible. A matrix that does not have an inverse is called singular. Most matrices don't have an inverse. The only kind of matrix that has

More information

Ex. No. 3 C PROGRAMMING

Ex. No. 3 C PROGRAMMING Ex. No. 3 C PROGRAMMING C is a powerful, portable and elegantly structured programming language. It combines features of a high-level language with the elements of an assembler and therefore, suitable

More information

CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-0-0)

CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-0-0) CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-0-0) Class Teacher: Pralay Mitra Department of Computer Science and Engineering Indian Institute of Technology Kharagpur Conceptual Idea

More information

Overview of Transformations (18 marks) In many applications, changes in orientations, size, and shape are accomplished with

Overview of Transformations (18 marks) In many applications, changes in orientations, size, and shape are accomplished with Two Dimensional Transformations In many applications, changes in orientations, size, and shape are accomplished with geometric transformations that alter the coordinate descriptions of objects. Basic geometric

More information

Case Control Structure. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan

Case Control Structure. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan Case Control Structure DCS COMSATS Institute of Information Technology Rab Nawaz Jadoon Assistant Professor COMSATS IIT, Abbottabad Pakistan Introduction to Computer Programming (ICP) Decision control

More information

Available online through ISSN

Available online through  ISSN International Research Journal of Pure Algebra -4(4), 2014, 509-513 Available online through www.rjpa.info ISSN 2248 9037 A STUDY OF UNBALANCED TRANSPORTATION PROBLEM AND USE OF OBJECT ORIENTED PROGRAMMING

More information

Chapter 11 Introduction to Programming in C

Chapter 11 Introduction to Programming in C C: A High-Level Language Chapter 11 Introduction to Programming in C Original slides from Gregory Byrd, North Carolina State University Modified slides by Chris Wilcox, Colorado State University! Gives

More information

United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017

United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017 United States Naval Academy Electrical and Computer Engineering Department EC310-6 Week Midterm Spring AY2017 1. Do a page check: you should have 8 pages including this cover sheet. 2. You have 50 minutes

More information

Sample Paper - II Subject Computer Science

Sample Paper - II Subject Computer Science Sample Paper - II Subject Computer Science Max Marks 70 Duration 3 hrs Note:- All questions are compulsory Q1) a) What is significance of My Computer? 2 b) Explain different types of operating systems.

More information

Array. Arijit Mondal. Dept. of Computer Science & Engineering Indian Institute of Technology Patna IIT Patna 1

Array. Arijit Mondal. Dept. of Computer Science & Engineering Indian Institute of Technology Patna IIT Patna 1 IIT Patna 1 Array Arijit Mondal Dept. of Computer Science & Engineering Indian Institute of Technology Patna arijit@iitp.ac.in Array IIT Patna 2 Many applications require multiple data items that have

More information

Single Dimension Arrays

Single Dimension Arrays ARRAYS Single Dimension Arrays Array Notion of an array Homogeneous collection of variables of same type. Group of consecutive memory locations. Linear and indexed data structure. To refer to an element,

More information

UNIT - II Selections Statements Iteration Statements Jump Statements- Expression Statements - Block Statements. Single Dimensional Arrays Generating

UNIT - II Selections Statements Iteration Statements Jump Statements- Expression Statements - Block Statements. Single Dimensional Arrays Generating UNIT - II Selections Statements Iteration Statements Jump Statements- Expression Statements - Block Statements. Single Dimensional Arrays Generating a Pointer to an Array Passing Single Dimension Arrays

More information

The program simply pushes all of the characters of the string into the stack. Then it pops and display until the stack is empty.

The program simply pushes all of the characters of the string into the stack. Then it pops and display until the stack is empty. EENG212 Algorithms & Data Structures Fall 0/07 Lecture Notes # Outline Stacks Application of Stacks Reversing a String Palindrome Example Infix, Postfix and Prefix Notations APPLICATION OF STACKS Stacks

More information