C PROGRAMMING LABORATORY SYLLABUSSUBJECT CODE ̵..

#### Category : CPL LAB

7. Implement using functions to check whether the given number is prime and display appropriate messages. (No built-in math function) ALGORITHM: Step 1: Start Step 2: [Read the value of N(positive integers)] Read N Step 3: [to check whether N is prime or not] For i=2 to m/2 If m%i=0 then go to ..

12. Develop a program to find the square root of a given number N and execute for all possible inputs with appropriate messages. Note: Donâ€™t use library function sqrt(n).Algorithm: Step 1: start Step 2: read number Step 3: calculate number to the power of 0.5(sq=pow(n,0.5)) Step 4: print sq Step 5: stop FLOWCHART: PROGRAM:#include<stdio.h>#include<math.h> int ..

3. Develop a program to compute the roots of a quadratic equation by accepting the coefficients. Print appropriate messages.Algorithm: Step1:[read the values of A,B and C] Read A,B,C Step2:[check for the co-efficients] If A=0 and B=0 and C=0 Then roots are non-determinant Step 3:[compute the value of Disc] ..

13. Implement structures to read, write, compute average- marks and the students scoring above and below the average marks for a class of N students.ALGORITHM: STEP 1: [input number of students] Read n STEP 2: [input details of students ie.name and marks] Read name,m1,m2,m3 STEP 3: [ Calculate total and average] For <- i=0 to ..

6. Introduce 1D Array manipulation and implement Binary search.Algorithm: Step 1:[read the value of N] Read N Step 2:[Enter the elements in ascending order] For i=0 to N-1 is to be read from the keyboard Step 3:[Enter the one element for searching that could be a key element] Step 4: initially set low=0 and ..

1. Familiarization with computer hardware and programming environment, concept of naming the program files, storing, compilation, execution and debugging, taking any simple C- code. [Not included in the Lab Exam ] Generally, the programs created using programming languages like C, C++, Java etc., are written using high level language like English. But, computer cannot understand ..

4. Develop a program to find the reverse of a positive integer and check for palindrome or not. Display appropriate messages. Algorithm:ALGORITHM:Step 1: [read the number N] Read NStep 2: initialize M=N,REV=0Step 3: [check the value of N] If N is not equal to 0 go to step 4 else go ..

10. Write functions to implement string operations such as compare, concatenate, string length. Convince the parameter passing techniques.Algorithm: Step 1: StartStep 2: read two stringsStep 3: calculate the string length using strlen()Step 4: compare the string using strcmp()Step 5: concatenate the strings using strcat()Step 6: print the stringlengthStep 7: print strings are equal or not ..

15. Implement Recursive functions for Binary to Decimal ConversionAlgorithm: Step 1: start Step 2: read number Step 3: if number is not equal to zero , goto step 4 else goto step 7 Step 4: calculate remainder number by 2, get n value by n divide by 2 Step 5: calculate decimal by adding decimal ..

## Recent Comments