BCSE1002: Computer Programming and Problem Solving LAB MANUAL

Size: px
Start display at page:

Download "BCSE1002: Computer Programming and Problem Solving LAB MANUAL"

Transcription

1 LABMANUAL BCSE1002: Computer Programming and Problem Solving LAB MANUAL L T P Course Type Semester Offered Academic Year Slot Class Room Faculty Details: Name Website link Designation School School of Computing Science and Engineering Cabin No Intercom Open Hours

2 List of Experiments 1 Write a C program to swap the two numbers. 2 Write a C program to find the roots of a quadratic equation. 3 Write a C program to compute the factorial of a given number. 4 Write a C program to find the series of prime numbers in the given range. 5 Write a C program to generate Fibonacci numbers in the given range. 6 Write a C program to check for number palindrome. 7 Write a C program to generate Pascal Triangle. Implement the following operations on matrices using C 8 a) Sum of Two Matrices b) Product of Two matrices c) Transpose of Matrix 9 Write a C program to find Factorial, GCD, fibonacci, towers of hanoi, sum of digits, base conversions, reversal of numbers. (Using recursion). Write a C program to implement all string operations(strlen(), strcpy(),, 10 strcmp(), strcat(), strrev(), strstr(), strchr()) without using standard string library functions. 11 Write a C program to find the student grade by using structures. 12 Write a C program to perform the operations addition, subtraction, multiplication of complex numbers using structures. 13 Write a C program to copy the file contents from one file to another file(pass file names as command line arguments).

3 Experiment: 1 Write a C program to swap the two numbers. AIM: To write a C Program to swap the two numbers. ALGORITHM: Step 1: Start step 2: read 'a' and 'b' value step 3: inter change the values temp=a a=b b=temp step 4: write a and b values. step 5:stop #include <stdio.h> int main() int a,b, temp; printf("enter the value of x and y \n"); scanf("%d %d", &a, &b); printf("before Swapping\n a = %d \n b = %d \n", a,b); temp = a; a = b; b = temp; printf("after Swapping\n a = %d \n b = %d \n", a,b); return 0;

4 Output of program: RESULT: Thus the C program for swapping two numbers was executed and output was obtained.

5 Experiment: 2 Write a C program to find the roots of a quadratic equation. AIM: To write a C Program to find the roots of a Quadratic equation. ALGORITHM: Step 1: Start Step 2: Read the variable a, b, c. Step 3: Compute d= b*b - 4*a*c. Step 4: Test the condition, d is greater than 0 using IF statement. Calculate: r1= (-b + sqrt(d)) / (2*a). Calculate: r2= (-b - sqrt(d)) / (2*a). Print the roots r1 and r2. Step 5: Else, test the condition, d is equal to 0 using IF statement. Calculate: r1=r2 = -b / (2*a). Print the roots r1 and r2. Step 6: Else, compute real and imaginary as Calculate: real = -b / (2*a). Calculate imag = sqrt(-d)/(2*a). Print the real and image. Step 7: Stop

6 #include <stdio.h> #include <math.h> #include <conio.h> void main() float a, b, c, d, r1,r2, real, imag ; clrscr(); printf("\n TO FIND THE ROOTS OF A QUADRATIC EQUATION"); printf("\nenter the coefficients a, b and c: "); scanf("%f%f%f",&a,&b,&c); d=b*b-4*a*c; if (d>0) r1= (-b+sqrt(d))/(2*a); r2= (-b-sqrt(d))/(2*a); printf("roots are: %.2f and %.2f.They are real and distinct.", r1, r2); else if (d= = 0) r1 = r2 = -b/(2*a); printf("roots are: %.2f and %.2f. They are real and equal.", r1, r2); else real= -b/(2*a); getch(); imag= sqrt(-d)/(2*a); printf("roots are: %.2f+%.2fi and %.2f-%.2fi. They are complex.", real, imag, real, imag);

7 INPUT AND OUTPUT: RESULT: Thus the C program for finding roots of quadratic equation was executed and output was obtained.

8 Experiment: 3 FACTORIAL OF A NUMBER AIM: To write a program to calculate the factorial of the given number using functions. ALGORITHM: Step 1: Start the program Step2: Enter a number. Step 3: Set a loop to find the factorial of the given no using Fact=fact*i Step 4: Print the factorial of the given number. Step 5: Stop the program #include<stdio.h> void main() int fact=1,i,num; printf("enter the number"); scanf("%d",&num); for(i=1;i<=num;i++) fact=fact*i; printf("the factorial of %dis %d",num,fact); getch();

9 INPUT AND OUTPUT: RESULT: Thus the C program to calculate factorial of the given number using function is calculated successfully and verified.

10 Experiment: 4 PRIME NUMBERS AIM: Write a program to find the given number is prime or not. ALGORITHM: Step 1: Start the program Step2: Enter a number. Step 3: Divide the number with (1 to 2) Step 4: If number is divisible by any value (1 to 2) it is not prime Step 5: Else it is prime Step 6: Stop Program: #include <stdio.h> int main() int loop, n; int prime = 1; Scanf( Enter the Number : %d, &n); for(loop = 2; loop < n; loop++) if((number % loop) == 0) prime = 0; if (prime == 1) printf("%d is prime number.", number);

11 else printf("%d is not a prime number.", number); return 0; INPUT AND OUTPUT: Enter the Number : is prime number. RESULT: Thus the C program find the prime number to given number is successfully and verified.

12 Experiment: 5 FIBONACCI SERIES AIM: To write a C program to find the Fibonacci series of the given number. ALGORITHM: Step 1. Start the program Step 2. Enter the number. Step 3. Check the number whether the number is zero or not. If zero print zero value.if not zero go further. Step 4. Set a loop upto the given number. Step 5. Assign fib=fib+a; a=b; b=c; Step 6. Every increment in the loop prints the value of fib. Step 7. After the execution of the loop, stop the program. #include<stdio.h> #include<conio.h> Void main() int num,fib=0,a=0,b=1,i; clrscr(); printf("enter the number"); scanf("%d",&num); printf("fibbonaci SERIES\n"); if(num==0) printf("0"); else for(i=0;i<num;i++) fib=fib+a; a=b; b=fib; printf("%d\t",fib); getch();

13 INPUT AND OUTPUT RESULT: Thus the C program to find Fibonacci series of the given number was executed and verified successfully.

14 Experiment: 6 PALINDROME NUMBER AIM: To write a C program to find the Palindrome or not of the given number. #include <stdio.h> int main() int number, t, rev=0, rmndr; printf("please enter a number to check Palindrome : "); scanf("%d",&number); printf("\nentered number: %d", number); t = number; while (number > 0) rmndr = number%10; rev = rev*10 + rmndr; number = number/10; printf("\nreversed number: %d", rev); if(t == rev) printf("\nentered number %d is a palindrome", t); else printf("\nentered number %d is not a palindrome", t); return 0; INPUT AND OUTPUT Please enter a number to check Palindrome : 656 Entered number: 656 Reversed number: 656 Entered number 656 is a palindrome RESULT: Thus the C program find the palindrome number to given number is successfully and verified.

15 Experiment: 7 PASCAL TRIANGLE AIM: To write a C program to draw the Pascal Triangle. #include <stdio.h> long fact(int); int main() int n, i, j; printf("please enter number of rows you would like to see in pascal triangle\n"); scanf("%d",&n); printf("pascal Triangle pattern:\n"); for ( i = 0 ; i < n ; i++ ) for ( j = 0 ; j <= ( n - i - 2 ) ; j++ ) printf(" "); for( j = 0 ; j <= i ; j++ ) printf("%ld ",fact(i)/(fact(j)*fact(i-j))); printf("\n"); return 0; long fact(int n) int c; long result = 1; for( c = 1 ; c <= n ; c++ ) result = result*c; return ( result );

16 Input and Output: Please enter number of rows you would like to see in pascal triangle 6 Pascal Triangle pattern: RESULT: Thus the C program for pascal triangle is successfully display.

17 Experiment: 8 Sum of Two Matrix AIM: To write a C program to sum of two matrix. #include <stdio.h> int main() int r, c, a[100][100], b[100][100], sum[100][100], i, j; printf("enter number of rows (between 1 and 100): "); scanf("%d", &r); printf("enter number of columns (between 1 and 100): "); scanf("%d", &c); printf("\nenter elements of 1st matrix:\n"); for(i=0; i<r; ++i) for(j=0; j<c; ++j) printf("enter element a%d%d: ",i+1,j+1); scanf("%d",&a[i][j]); printf("enter elements of 2nd matrix:\n"); for(i=0; i<r; ++i) for(j=0; j<c; ++j) printf("enter element a%d%d: ",i+1, j+1); scanf("%d", &b[i][j]); // Adding Two matrices for(i=0;i<r;++i) for(j=0;j<c;++j)

18 sum[i][j]=a[i][j]+b[i][j]; // Displaying the result printf("\nsum of two matrix is: \n\n"); for(i=0;i<r;++i) for(j=0;j<c;++j) printf("%d ",sum[i][j]); if(j==c-1) printf("\n\n"); return 0; Input and Output Enter number of rows (between 1 and 100): 2 Enter number of columns (between 1 and 100): 3 Enter elements of 1st matrix: Enter element a11: 2 Enter element a12: 3 Enter element a13: 4 Enter element a21: 5 Enter element a22: 2 Enter element a23: 3 Enter elements of 2nd matrix: Enter element a11: -4 Enter element a12: 5 Enter element a13: 3 Enter element a21: 5 Enter element a22: 6

19 Enter element a23: 3 Sum of two matrix is: RESULT: Thus the C program to sum of two matrix was successfully and verified. Experiment: 8a Product of Two Matrix

20 AIM: To write a C program to product of two matrix. #include <stdio.h> int main() int a[10][10], b[10][10], result[10][10], r1, c1, r2, c2, i, j, k; printf("enter rows and column for first matrix: "); scanf("%d %d", &r1, &c1); printf("enter rows and column for second matrix: "); scanf("%d %d",&r2, &c2); // Column of first matrix should be equal to column of second matrix and while (c1!= r2) printf("error! column of first matrix not equal to row of second.\n\n"); printf("enter rows and column for first matrix: "); scanf("%d %d", &r1, &c1); printf("enter rows and column for second matrix: "); scanf("%d %d",&r2, &c2); // Storing elements of first matrix. printf("\nenter elements of matrix 1:\n"); for(i=0; i<r1; ++i) for(j=0; j<c1; ++j) printf("enter elements a%d%d: ",i+1, j+1); scanf("%d", &a[i][j]); // Storing elements of second matrix.

21 printf("\nenter elements of matrix 2:\n"); for(i=0; i<r2; ++i) for(j=0; j<c2; ++j) printf("enter elements b%d%d: ",i+1, j+1); scanf("%d",&b[i][j]); // Initializing all elements of result matrix to 0 for(i=0; i<r1; ++i) for(j=0; j<c2; ++j) result[i][j] = 0; // Multiplying matrices a and b and // storing result in result matrix for(i=0; i<r1; ++i) for(j=0; j<c2; ++j) for(k=0; k<c1; ++k) result[i][j]+=a[i][k]*b[k][j]; // Displaying the result printf("\noutput Matrix:\n"); for(i=0; i<r1; ++i) for(j=0; j<c2; ++j) printf("%d ", result[i][j]); if(j == c2-1) printf("\n\n");

22 return 0; INPUT AND OUTPUT: Enter rows and column for first matrix: 3 2 Enter rows and column for second matrix: 3 2 Error! column of first matrix not equal to row of second. Enter rows and column for first matrix: 2 3 Enter rows and column for second matrix: 3 2 Enter elements of matrix 1: Enter elements a11: 3 Enter elements a12: -2 Enter elements a13: 5 Enter elements a21: 3 Enter elements a22: 0 Enter elements a23: 4 Enter elements of matrix 2: Enter elements b11: 2 Enter elements b12: 3 Enter elements b21: -9 Enter elements b22: 0 Enter elements b31: 0 Enter elements b32: 4 Output Matrix: RESULT: Thus the C program to product of two matrix was successfully and verified. Experiment: 8b Transpose of Matrix AIM: To write a C program to transpose of matrix.

23 #include <stdio.h> int main() int a[10][10], transpose[10][10], r, c, i, j; printf("enter rows and columns of matrix: "); scanf("%d %d", &r, &c); // Storing elements of the matrix printf("\nenter elements of matrix:\n"); for(i=0; i<r; ++i) for(j=0; j<c; ++j) printf("enter element a%d%d: ",i+1, j+1); scanf("%d", &a[i][j]); // Displaying the matrix a[][] */ printf("\nentered Matrix: \n"); for(i=0; i<r; ++i) for(j=0; j<c; ++j) printf("%d ", a[i][j]); if (j == c-1) printf("\n\n"); // Finding the transpose of matrix a for(i=0; i<r; ++i) for(j=0; j<c; ++j) transpose[j][i] = a[i][j];

24 // Displaying the transpose of matrix a printf("\ntranspose of Matrix:\n"); for(i=0; i<c; ++i) for(j=0; j<r; ++j) printf("%d ",transpose[i][j]); if(j==r-1) printf("\n\n"); return 0; Input and Output: Enter rows and columns of matrix: 2 3 Enter element of matrix: Enter element a11: 2 Enter element a12: 3 Enter element a13: 4 Enter element a21: 5 Enter element a22: 6 Enter element a23: 4 Entered Matrix: Transpose of Matrix:

25 RESULT: Thus the C program to transpose of matrix was successfully and verified. Experiment: 9 Fibonacci Series by using recursion AIM: To write a C program to display Fibonacci series by using recursion. #include<stdio.h> int Fibonacci(int); int main() int n, i = 0, c; scanf("%d",&n); printf("fibonacci series\n"); for ( c = 1 ; c <= n ; c++ ) printf("%d\n", Fibonacci(i)); i++; return 0;

26 int Fibonacci(int n) if ( n == 0 ) return 0; else if ( n == 1 ) return 1; else return ( Fibonacci(n-1) + Fibonacci(n-2) ); RESULT: Thus the C program for Fibonacci series with recursion was successfully and verified. Experiment: 9a. GCD by using recursion AIM: Write a C program to find the GCD of given two numbers. #include <stdio.h> int gcd(int, int); int main() int num1, num2; printf("enter two integers: "); scanf("%d%d", &num1, &num2); printf("the greatest common divisor of %d and %d is %d", num1, num2, gcd(num1, num2)); return 0; int gcd(int x, int y) if (x % y == 0)

27 return y; else return gcd(y, x % y); Input and Output: Enter two integers: The greatest common divisor of 18 and 84 is 6 RESULT: Thus the C program GCD with recursion was successfully and verified. Experiment: 9b. Towers of Hanoi by using recursion AIM: Write a C program to display the towers of Hanoi. /* C Program to Solve Towers of Hanoi Problem */ #include<stdio.h> #include<conio.h> void hanoi(int, char, char, char); void main() int disks; char source, destination, aux; clrscr();

28 printf("\nenter No. of Disks:"); scanf("%d",&disks); printf("\nenter Source, Destination and Auxillary Disk Names:"); scanf("%s%s%s",source, destination, aux); hanoi(disks,source,destination,aux); getch(); void hanoi(int n, char s, char d, char a) if(n>0) hanoi(n-1,s,a,d); printf("\n%d is moved from %s to %s",n,s,d); hanoi(n-1,a,d,s); Output:

29 RESULT: Thus the C program display the towers of Hanoi with recursion was successfully run. Experiment: 9c. Towers of Hanoi by using recursion AIM: Write a C program to find the sum of digits. #include <stdio.h> int sumofdigits(int num);

30 int main() int num, sum; printf("enter any number to find sum of digits: "); scanf("%d", &num); sum = sumofdigits(num); printf("sum of digits of %d = %d", num, sum); return 0; int sumofdigits(int num) if(num == 0) return 0; return ((num % 10) + sumofdigits(num / 10)); Input and Output: Enter the number: 2345 Sum of digits in 2345 is 14 RESULT: Thus the C program in sum of digits with recursion was successfully run. Experiment: 9d. Basic conversion by using recursion AIM: Write a C program to find the basic conversion. #include <stdio.h>

31 int find(int decimal_number) if (decimal_number == 0) return 0; else return (decimal_number % * find(decimal_number / 2)); int main() int decimal_number; scanf( Enter the Decimal number = %d, &decimal_number); printf("%d", find(decimal_number)); return 0; Input and Output: Enter the Decimal number = RESULT: Thus the C program in sum of digits with recursion was successfully run. Experiment: 9d. reversal of numbers by using recursion AIM: Write a C program to find the reversal of numbers. #include<stdio.h>

32 int main() int num,reverse_number; //User would input the number printf("\nenter any number:"); scanf("%d",&num); //Calling user defined function to perform reverse reverse_number=reverse_function(num); printf("\nafter reverse the no is :%d",reverse_number); return 0; int sum=0,rem; reverse_function(int num) if(num) rem=num%10; sum=sum*10+rem; reverse_function(num/10); else return sum; return sum; Input and Output: Enter any number: After reverse the no is :65432 RESULT: Thus the C program in reversal of numbers with recursion was successfully run. Experiment: 10. AIM: String operations program Write a C program to implement all string operations(strlen(), strcpy(),, strcmp(), strcat(), strrev(), strstr(), strchr()) without using standard string library functions.

33 #include <stdio.h> #include <string.h> int main () char str1[12] = "Hello"; char str2[12] = "World"; char str3[12]; int len ; /* copy str1 into str3 */ strcpy(str3, str1); printf("strcpy( str3, str1) : %s\n", str3 ); /* concatenates str1 and str2 */ strcat( str1, str2); printf("strcat( str1, str2): %s\n", str1 ); /* total lenghth of str1 after concatenation */ len = strlen(str1); printf("strlen(str1) : %d\n", len ); return 0; Input and Output: strcpy( str3, str1) : Hello strcat( str1, str2): HelloWorld strlen(str1) : 10 Result: Thus the String operations in C program was successfully run. Experiment: 11. String operations program AIM: Write a C program to find the student grade by using structures. #include <stdio.h>

34 struct student char name[50]; int roll; float marks; s[10]; int main() int i; printf("enter information of students:\n"); // storing information for(i=0; i<10; ++i) s[i].roll = i+1; printf("\nfor roll number%d,\n",s[i].roll); printf("enter name: "); scanf("%s",s[i].name); printf("enter marks: "); scanf("%f",&s[i].marks); printf("\n"); printf("displaying Information:\n\n"); // displaying information for(i=0; i<10; ++i) printf("\nroll number: %d\n",i+1); printf("name: "); puts(s[i].name); printf("marks: %.1f",s[i].marks); printf("\n"); return 0; Input and Output: Enter information of students: For roll number1, Enter name: Tom Enter marks: 98

35 Displaying Information: Roll number: 1 Name: Tom Marks: 98 Result: Thus the student details with structures in C program was successfully run. Experiment: 12. AIM: Arithmetic operation with structures Write a C program to perform the operations addition, subtraction, multiplication of complex numbers using structures. #include <stdio.h> typedef struct complex

36 float real; float imag; complex; complex add(complex n1,complex n2); int main() complex n1, n2, temp; printf("for 1st complex number \n"); printf("enter real and imaginary part respectively:\n"); scanf("%f %f", &n1.real, &n1.imag); printf("\nfor 2nd complex number \n"); printf("enter real and imaginary part respectively:\n"); scanf("%f %f", &n2.real, &n2.imag); temp = add(n1, n2); printf("sum = %.1f + %.1fi", temp.real, temp.imag); return 0; complex add(complex n1, complex n2) complex temp; temp.real = n1.real + n2.real; temp.imag = n1.imag + n2.imag; return(temp); Input and Output: For 1st complex number Enter real and imaginary part respectively: For 2nd complex number

37 Enter real and imaginary part respectively: Sum = i Result: Thus the complex numbers with arithmetic operations in c program with structures was successfully run. Experiment: 13. AIM : Arithmetic operation with structures Write a C program to copy the file contents from one file to another file(pass file names as command line argument). #include <stdio.h> #include <conio.h>

38 void main() FILE *f1, *f2; char c; clrscr(); printf( Enter the data to the file1.txt file \n ); f1 = fopen( file1.txt, w ); while((c = getchar())!= EOF) putc(c, f1); fclose(f1); f2 = fopen( file2.txt, w ); f1 = fopen( file1.txt, r ); while((c = getc(f1))!= EOF) putc(c,f2); fclose(f1); fclose(f2); printf( after copying the data in file2.txt file is \n ); f2 = fopen( file2.txt, r ); while((c = getc(f2))!= EOF) printf( %c, c); fclose(f2); getch(); Input and Output: Enter the data to the file1.txt file STUDENT BOX OFFICE.IN After copying the data in file2.txt file is STUDENT BOX OFFICE.IN

39 Result: Thus the copy the file contents from one file to another file(pass file names as command line argument) was successfully run.

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

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

/* 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

'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

Write a C program to add two Complex numbers using functions illustrating-

Write a C program to add two Complex numbers using functions illustrating- Scheme of valuvation Date : 29/8/2017 Marks: 40 Subject & Code : Data Structures and Applications (15CS33) Class : III A&B Name of Faculty : Ms. Saritha Time : 8:30 am to 10 am NOTE: ANSWER All FIVE QUESTIONS

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

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

struct structure_name { //Statements };

struct structure_name { //Statements }; Introduction to Structure http://www.studytonight.com/c/structures-in-c.php Structure is a user-defined data type in C which allows you to combine different data types to store a particular type of record.

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

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 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

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

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

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

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

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

Aryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9

Aryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9 Fundamental of C Programming Unit I: Q1. What will be the value of the following expression? (2017) A + 9 Q2. Write down the C statement to calculate percentage where three subjects English, hindi, maths

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

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

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

Questions Bank. 14) State any four advantages of using flow-chart

Questions Bank. 14) State any four advantages of using flow-chart Questions Bank Sub:PIC(22228) Course Code:-EJ-2I ----------------------------------------------------------------------------------------------- Chapter:-1 (Overview of C Programming)(10 Marks) 1) State

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

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

To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows

To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows Unti 4: C Arrays Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type An array is used to store a collection of data, but it is often more useful

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

Then, we created a structure array of size 10 to store information of 10 students.

Then, we created a structure array of size 10 to store information of 10 students. 1 LAB8: C Structures Task1: Write a program stores the information (name, roll and marks) of 10 students using structures. In this program, a structure, student is created. This structure has three members:

More information

COP 3223 Introduction to Programming with C - Study Union - Fall 2017

COP 3223 Introduction to Programming with C - Study Union - Fall 2017 COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................

More information

COP 3223 Introduction to Programming with C - Study Union - Fall 2017

COP 3223 Introduction to Programming with C - Study Union - Fall 2017 COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................

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

1. Basics 1. Write a program to add any two-given integer. Algorithm Code 2. Write a program to calculate the volume of a given sphere Formula Code

1. Basics 1. Write a program to add any two-given integer. Algorithm Code  2. Write a program to calculate the volume of a given sphere Formula Code 1. Basics 1. Write a program to add any two-given integer. Algorithm - 1. Start 2. Prompt user for two integer values 3. Accept the two values a & b 4. Calculate c = a + b 5. Display c 6. Stop int a, b,

More information

APS105. Collecting Elements 10/20/2013. Declaring an Array in C. How to collect elements of the same type? Arrays. General form: Example:

APS105. Collecting Elements 10/20/2013. Declaring an Array in C. How to collect elements of the same type? Arrays. General form: Example: Collecting Elements How to collect elements of the same type? Eg:., marks on assignments: APS105 Arrays Textbook Chapters 6.1-6.3 Assn# 1 2 3 4 5 6 Mark 87 89 77 96 87 79 Eg: a solution in math: x 1, x

More information

Department of Computer Science & Engineering Indian Institute of Technology Kharagpur. Practice Sheet #05

Department of Computer Science & Engineering Indian Institute of Technology Kharagpur. Practice Sheet #05 Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Topic: Functions in C Practice Sheet #05 Date: 30-01-2017 Instructions: For the questions consisting code segments,

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

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

Bangalore South Campus

Bangalore South Campus USN: 1 P E PESIT Bangalore South Campus Hosur road, 1km before ElectronicCity, Bengaluru -100 Department of Basic Science and Humanities INTERNAL ASSESSMENT TEST 3 Date: 22/11/2017 Time:11:30am- 1.00 pm

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 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

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR

VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANGULATHUR 603 203 FIRST SEMESTER B.E / B.Tech., (Common to all Branches) QUESTION BANK - GE 6151 COMPUTER PROGRAMMING UNIT I - INTRODUCTION Generation and

More information

Subject: PIC Chapter 2.

Subject: PIC Chapter 2. 02 Decision making 2.1 Decision making and branching if statement (if, if-, -if ladder, nested if-) Switch case statement, break statement. (14M) 2.2 Decision making and looping while, do, do-while statements

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

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 ElectronicCity, Bengaluru -100 Department of Basic Science and Humanities

PESIT Bangalore South Campus Hosur road, 1km before ElectronicCity, Bengaluru -100 Department of Basic Science and Humanities INTERNAL ASSESSMENT TEST-3 Date : 12-05-2016 Marks: 40 Subject & Code : Programming in C and data structures (15PCD23) Sec : F,G,H,I,J,K Name of faculty :Dr J Surya Prasad/Mr.Sreenath M V/Ms.Monika/ Time

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

Department of Computer Science & Engineering Indian Institute of Technology Kharagpur. Practice Sheet #06

Department of Computer Science & Engineering Indian Institute of Technology Kharagpur. Practice Sheet #06 Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Practice Sheet #06 Topic: Recursion in C 1. What string does the following program print? #include #include

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

4(a) ADDITION OF TWO NUMBERS. Program:

4(a) ADDITION OF TWO NUMBERS. Program: 4(a) ADDITION OF TWO NUMBERS int a,b,c: printf( enter the elements a and b ); scanf( %d%d,&a,&b); c=a+b; printf( sum of the elements is%d,c); Output: Enter the elements a and b: 4 5 Sum of the elements

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

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

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

MA 511: Computer Programming Lecture 3: Partha Sarathi Mandal

MA 511: Computer Programming Lecture 3: Partha Sarathi Mandal MA 511: Computer Programming Lecture 3: http://www.iitg.ernet.in/psm/indexing_ma511/y10/index.html Partha Sarathi Mandal psm@iitg.ernet.ac.in Dept. of Mathematics, IIT Guwahati Semester 1, 2010-11 Last

More information

Eastern Mediterranean University School of Computing and Technology Information Technology Lecture7 Strings and Characters

Eastern Mediterranean University School of Computing and Technology Information Technology Lecture7 Strings and Characters Eastern Mediterranean University School of Computing and Technology Information Technology Lecture7 Strings and Characters Using Strings The string in C programming language is actually a one-dimensional

More information

Learning C Language. For BEGINNERS. Remember! Practice will make you perfect!!! :D. The 6 th week / May 24 th, Su-Jin Oh

Learning C Language. For BEGINNERS. Remember! Practice will make you perfect!!! :D. The 6 th week / May 24 th, Su-Jin Oh Remember! Practice will make you perfect!!! :D Learning C Language For BEGINNERS The 6 th week / May 24 th, 26 Su-Jin Oh sujinohkor@gmail.com 1 Index Basics Operator Precedence Table and ASCII Code Table

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

Computer Programming Unit 3

Computer Programming Unit 3 POINTERS INTRODUCTION Pointers are important in c-language. Some tasks are performed more easily with pointers such as dynamic memory allocation, cannot be performed without using pointers. So it s very

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

COP 3223 Introduction to Programming with C - Study Union - Spring 2018

COP 3223 Introduction to Programming with C - Study Union - Spring 2018 COP 3223 Introduction to Programming with C - Study Union - Spring 2018 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................

More information

It is necessary to have a single function main in every C program, along with other functions used/defined by the programmer.

It is necessary to have a single function main in every C program, along with other functions used/defined by the programmer. Functions A number of statements grouped into a single logical unit are called a function. The use of function makes programming easier since repeated statements can be grouped into functions. Splitting

More information

Scheme of valuations-test 3 PART 1

Scheme of valuations-test 3 PART 1 Scheme of valuations-test 3 PART 1 1 a What is string? Explain with example how to pass string to a function. Ans A string constant is a one-dimensional array of characters terminated by a null ( \0 )

More information

Write a C program using arrays and structure

Write a C program using arrays and structure 03 Arrays and Structutes 3.1 Arrays Declaration and initialization of one dimensional, two dimensional and character arrays, accessing array elements. (10M) 3.2 Declaration and initialization of string

More information

LABORATORY MANUAL. (CSE-103F) FCPC Lab

LABORATORY MANUAL. (CSE-103F) FCPC Lab LABORATORY MANUAL (CSE-103F) FCPC Lab Department of Computer Science & Engineering BRCM College of Engineering & Technology Bahal, Haryana Aim: Main aim of this course is to understand and solve logical

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

F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C

F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C F.Y. Diploma : Sem. II [CO/CD/CM/CW/IF] Programming in C Time : 3 Hrs.] Prelim Question Paper Solution [Marks : 70 Q.1 Attempt any FIVE of the following : [10] Q.1 (a) List any four relational operators.

More information

Principles of C and Memory Management

Principles of C and Memory Management COMP281 Lecture 9 Principles of C and Memory Management Dr Lei Shi Last Lecture Today Pointer to Array Pointer Arithmetic Pointer with Functions struct Storage classes typedef union String struct struct

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

CPS 101 Introduction to Computational Science

CPS 101 Introduction to Computational Science CPS 101 Introduction to Computational Science Wensheng Shen Department of Computational Science SUNY Brockport Chapter 10: Program in C Why C language: C is the language which can be used for both system

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

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

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) 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

Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters,

Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters, Strings Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters, decimal digits, special characters and escape

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

PROGRAMMING IN C AND C++:

PROGRAMMING IN C AND C++: PROGRAMMING IN C AND C++: Week 1 1. Introductions 2. Using Dos commands, make a directory: C:\users\YearOfJoining\Sectionx\USERNAME\CS101 3. Getting started with Visual C++. 4. Write a program to print

More information

MA 511: Computer Programming Lecture 2: Partha Sarathi Mandal

MA 511: Computer Programming Lecture 2: Partha Sarathi Mandal MA 511: Computer Programming Lecture 2: http://www.iitg.ernet.in/psm/indexing_ma511/y10/index.html Partha Sarathi Mandal psm@iitg.ernet.ac.in Dept. of Mathematics, IIT Guwahati Semester 1, 2010-11 Largest

More information

Chapter 8 Character Arrays and Strings

Chapter 8 Character Arrays and Strings Chapter 8 Character Arrays and Strings INTRODUCTION A string is a sequence of characters that is treated as a single data item. String constant: String constant example. \ String constant example.\ \ includes

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

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

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

B.L.D.E.A s Vachana Pitamaha Dr. P. G. Halakatti College of Engineering and Technology, Vijayapur

B.L.D.E.A s Vachana Pitamaha Dr. P. G. Halakatti College of Engineering and Technology, Vijayapur B.L.D.E.A s Vachana Pitamaha Dr. P. G. Halakatti College of Engineering and Technology, Vijayapur-586103. Department of Computer Science and Engineering Lab Manual Subject : Computer Programming Laboratory

More information

(2½ Hours) [Total Marks: 75

(2½ Hours) [Total Marks: 75 (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. Arash Rafiey. September 26, 2017

Functions. Arash Rafiey. September 26, 2017 September 26, 2017 are the basic building blocks of a C program. are the basic building blocks of a C program. A function can be defined as a set of instructions to perform a specific task. are the basic

More information

Programming & Data Structure Laboratory. Arrays, pointers and recursion Day 5, August 5, 2014

Programming & Data Structure Laboratory. Arrays, pointers and recursion Day 5, August 5, 2014 Programming & Data Structure Laboratory rrays, pointers and recursion Day 5, ugust 5, 2014 Pointers and Multidimensional rray Function and Recursion Counting function calls in Fibonacci #include

More information

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

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 17 EXAMINATION Subject Name: Data Structure Using C Model Answer Subject Code: 17330 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as

More information

COMPUTER PROGRAMMING LAB

COMPUTER PROGRAMMING LAB COURSE OUTCOMES SEMESTER I Student will be able to: COMPUTER PROGRAMMING LAB 1. Explain basic commands in Linux. 2. Develop programs in C language. 3. Design programs for various problems in C language.

More information

Eastern Mediterranean University School of Computing and Technology Information Technology Lecture5 C Characters and Strings

Eastern Mediterranean University School of Computing and Technology Information Technology Lecture5 C Characters and Strings Eastern Mediterranean University School of Computing and Technology Information Technology Lecture5 C Characters and Strings Using Strings The string in C programming language is actually a one-dimensional

More information

SUMMER 13 EXAMINATION Model Answer

SUMMER 13 EXAMINATION 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

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

Sri vidya college of engineering and technology UNIT II FUNCTIONS, POINTERS, STRUCTURES AND UNIONS

Sri vidya college of engineering and technology UNIT II FUNCTIONS, POINTERS, STRUCTURES AND UNIONS UNIT II FUNCTIONS, POINTERS, STRUCTURES AND UNIONS FUNCTIONS AND POINTERS Functions are created when the same process or an algorithm to be repeated several times in various places in the program. Function

More information

C Programming Lecture V

C Programming Lecture V C Programming Lecture V Instructor Özgür ZEYDAN http://cevre.beun.edu.tr/ Modular Programming A function in C is a small sub-program that performs a particular task, and supports the concept of modular

More information

Syntax of for loop is as follows: for (inite; terme; updatee) { block of statements executed if terme is true;

Syntax of for loop is as follows: for (inite; terme; updatee) { block of statements executed if terme is true; Birla Institute of Technology & Science, Pilani Computer Programming (CSF111) Lab-5 ---------------------------------------------------------------------------------------------------------------------------------------------

More information

SOLUTION FOR FUNCTION. 1) Write a program to display Hello 10 times. Create user-defined function message().

SOLUTION FOR FUNCTION. 1) Write a program to display Hello 10 times. Create user-defined function message(). SOLUTION FOR FUNCTION 1) Write a program to display Hello 10 times. Create user-defined function message(). #include #include void message(int); int i; for (i=1;i

More information

Contents ARRAYS. Introduction:

Contents ARRAYS. Introduction: UNIT-III ARRAYS AND STRINGS Contents Single and Multidimensional Arrays: Array Declaration and Initialization of arrays Arrays as function arguments. Strings: Initialization and String handling functions.

More information

I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK a) What is the difference between Hardware and Software? Give one example for each.

I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK a) What is the difference between Hardware and Software? Give one example for each. I SEMESTER EXAM : : XI :COMPUTER SCIENCE : MAX MARK 70. a) What is the difference between Hardware and Software? Give one example for each. b) Give two differences between primary and secondary memory.

More information

INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator

INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator EXAMINATION ( End Semester ) SEMESTER ( Spring ) Roll Number Section Name Subject Number C S 1 0 0 0 1 Subject Name Programming

More information

PDS Class Test 2. Room Sections No of students

PDS Class Test 2. Room Sections No of students PDS Class Test 2 Date: October 27, 2016 Time: 7pm to 8pm Marks: 20 (Weightage 50%) Room Sections No of students V1 Section 8 (All) Section 9 (AE,AG,BT,CE, CH,CS,CY,EC,EE,EX) V2 Section 9 (Rest, if not

More information

Lab Manual. Program Design and File Structures (P): IT-219

Lab Manual. Program Design and File Structures (P): IT-219 Lab Manual Program Design and File Structures (P): IT-219 Lab Instructions Several practicals / programs? Whether an experiment contains one or several practicals /programs One practical / program Lab

More information

LAB 7 FUNCTION PART 2

LAB 7 FUNCTION PART 2 LAB 7 FUNCTION PART 2 School of Computer and Communication Engineering Universiti Malaysia Perlis 1 OBJECTIVES 1. To differentiate the file scope and block scope. 2. To write recursive function. 3. To

More information

Columns A[0] A[0][0] = 20 A[0][1] = 30

Columns A[0] A[0][0] = 20 A[0][1] = 30 UNIT Arrays and Strings Part A (mark questions). What is an array? (or) Define array. An array is a collection of same data type elements All elements are stored in continuous locations Array index always

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

Concept of algorithms Understand and use three tools to represent algorithms: Flowchart Pseudocode Programs

Concept of algorithms Understand and use three tools to represent algorithms: Flowchart Pseudocode Programs Morteza Noferesti Concept of algorithms Understand and use three tools to represent algorithms: Flowchart Pseudocode Programs We want to solve a real problem by computers Take average, Sort, Painting,

More information

Introduction to Computing Lecture 07: Repetition and Loop Statements (Part II)

Introduction to Computing Lecture 07: Repetition and Loop Statements (Part II) Introduction to Computing Lecture 07: Repetition and Loop Statements (Part II) Assist.Prof.Dr. Nükhet ÖZBEK Ege University Department of Electrical & Electronics Engineering nukhet.ozbek@ege.edu.tr Topics

More information

COMP 2001/2401 Test #1 [out of 80 marks]

COMP 2001/2401 Test #1 [out of 80 marks] COMP 2001/2401 Test #1 [out of 80 marks] Duration: 90 minutes Authorized Memoranda: NONE Note: for all questions, you must show your work! Name: Student#: 1. What exact shell command would you use to:

More information

Fundamentals of Programming & Procedural Programming

Fundamentals of Programming & Procedural Programming Universität Duisburg-Essen PRACTICAL TRAINING TO THE LECTURE Fundamentals of Programming & Procedural Programming Session Four: Functions: Built-in, Parameters and Arguments, Fruitful and Void Functions

More information