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

Read more

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

Read more

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

Read more

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

Read more

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

Read more

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

Read more

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

Read more

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

Read more

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

Read more