MCQ

Java Program to Implement the sin() Function (approximately) – Sanfoundry

This is the Java Program to Implement the sin() Function (approximately). Problem Description Given an angle say x, in degrees find out the sine of the angle approximately. Problem Solution The sine of an angle x can be calculated using the following equation sin x = x – (x3)/3! + (x5)/5! – (x7)/7! + ….. …

Java Program to Implement the sin() Function (approximately) – Sanfoundry Read More »

Java Program to Implement the cos() Function(approximately) – Sanfoundry

This is the Java Program to Implement the cos() Function (approximately). Problem Description Given an angle say x, in degrees find out the cosine of the angle approximately. Problem Solution The cosine of an angle x can be calculated using the following equation cos x = 1 – (x2)/2! + (x4)/4! – (x6)/6! + ….. …

Java Program to Implement the cos() Function(approximately) – Sanfoundry Read More »

Java Program to Find the First Capital Letter/Small Letter/Vowel/Consonant/Number/White Space/Special Character in a Given String – Sanfoundry

This is the Java Program to Find the First Capital Letter/Small Letter/Vowel/Consonant/Number/White Space/Special Character in a Given String. Problem Description Given a string, find the first position of the capital letter, small letter, vowel, consonant, whitespace, and special character if present in the string.Example: String x = “Ac @” Output =Capital letter = 1Small letter …

Java Program to Find the First Capital Letter/Small Letter/Vowel/Consonant/Number/White Space/Special Character in a Given String – Sanfoundry Read More »

Java Program to Find the Sum and Product of Elements in a Row/Column – Sanfoundry

This is the Java Program to Find the Sum and Product of Elements in a Row/Column. Problem Description Given a square matrix, print the sum and product of the elements in each row and column.Example:Matrix:1 2 3 45 6 7 89 10 11 1213 14 15 16 Output: Sum Product10     2428     58526     168032     168042     1188036     …

Java Program to Find the Sum and Product of Elements in a Row/Column – Sanfoundry Read More »

Java Program to Implement Heap Sort on an Array of n Elements – Sanfoundry

This is the Java Program to Implement Heap Sort on an Array of n Elements. Problem Description Given an array of integers, sort the array using heap sort algorithm. Problem Solution The idea is to create a max heap of the array elements. Then, obtain the maximum element from the heap, interchange it with the …

Java Program to Implement Heap Sort on an Array of n Elements – Sanfoundry Read More »