Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 2383 of 3366
297 Views
Given with the rate of filling the tank, height of a tank and radius of a tank and the task is to check whether the tank is overflow, underflow and filled in given time.ExampleInput-: radius = 2, height = 5, rate = 10 Output-: tank overflow Input-: radius = 5, height = 10, rate = 10 Output-: tank undeflowApproach used below is as follows −Input the rate of filling time, height and radius of a tankCalculate the volume of a tank to find the original rate of flow of water.Check for the conditions to determine the resultIf expected < original ... Read More
44K+ Views
Given with an input by the user and the task is to check whether the given input is an integer or a string. Integer can be any combination of digits between 0 -9 and string can be any combination excluding 0 – 9. Example Input-: 123 Output-: 123 is an integer Input-: Tutorials Point Output-: Tutorials Point is a string Approach used below is as follows − Input the data. Apply isdigit() function that checks whether a given input is numeric character or not. This function takes single argument as an integer and also returns ... Read More
1K+ Views
Given with an input of string and the task is to check whether the first and last characters of given string is equal or not.ExampleInput-: study Output-: not equal As the starting character is ‘s’ and the end character of a string is ‘y’ Input-: nitin Output-: yes it have first and last equal characters As the starting character is ‘n’ and the end character of a string is ‘n’Approach used below is as follows −Input the string and store in an array of strings.Calculate the length of a string using length() functionCheck first and last element of ... Read More
269 Views
Given a n number of vertices of a graph, the task is to calculate the edge cover of the graph. Edge cover is to find the minimum number of edges required to cover every vertex of the graph.Like we have n = 5Then its graph will be like −So its edge cover is 3Let’s take another example where the n is 8And its edge cover will be:4ExampleInput: n= 5 Output: 3 Input: n= 8 Output: 4Approach used below is as follows −Take the input from the userFind the ceiling value of the result of number of vertices by dividing it ... Read More
4K+ Views
Given with the cost price(CP) and the selling price(SP) and the task is to calculate the profit gained or loss incurred.Cost price or CP is the price at which the product is purchased by the seller and the selling price or SP is the price at which the product is sold by the seller.There is a formula to calculate profit gained or loss incurredProfit = Selling price – Cost priceIf Selling price is greater than cost price than there will be a profitLoss = Cost price – Selling priceIf cost price is greater than selling price than there will be ... Read More
2K+ Views
Given with the original cost and net price as an input and the task is to calculate the GST percentage and display the resultGST stands for Goods and Service task. It is always included in the Net price of the product and before calculating the GST percentage we need to calculate GST amount and for that there are formulas availableNetprice = originalcost + GSTAmountGSTAmount = Netprice – original_costGST_Percentage = (GSTAmount * 100)/ originalcostGST % formula = (GSTAmount*100) / originalcostExampleInput-: cost = 120.00 price = 150.00 Output-: GST amount is = 25.00 % Input-: price = 120.00 cost = ... Read More
3K+ Views
Given with the two points coordinates and the task is to find the distance between two points and display the result.In a two dimension plane there are two points let’s say A and B with the respective coordinates as (x1, y1) and (x2, y2) and to calculate the distance between them there is a direct formula which is given below$$\sqrt{\lgroup x2-x1\rgroup^{2}+\lgroup y2-y1\rgroup^{2}}$$Given below is the diagram representing two points and their differences$$\frac{(x_2-x_1)}{(x_1, y_1)\:\:\:\:\:\:(y_2-y_1)\:\:\:\:\:\:(x_2, y_2)}$$Approach used below is as follows −Input the coordinates as x1, x2, y1 and y2Apply the formula to compute the difference between two pointsPrint the distanceAlgorithmStart Step ... Read More
1K+ Views
Given with the 3-D plane and hence three coordinates and the task is to find the distance between the given points and display the result.In a three dimension plane there are three axis that are x-axis with its coordinates as (x1, y1, z1), y-axis with its coordinates as (x2, y2, z2) and z-axis with its coordinates as (x3, y3, z). To calculate the distance between them there is a direct formula which is given below$$\sqrt{\lgroup x2-x1\rgroup^{2}+\lgroup y2-y1\rgroup^{2}+\lgroup z2-z1\rgroup^{2}}$$Given below is the diagram representing three different axis and their coordinatesApproach used below is as follows −Input the coordinates as (x1, y1, ... Read More
28K+ Views
Given with the current date and the birth date of a person and the task is to calculate his current age.ExampleInput-: present date-: 21/9/2019 Birth date-: 25/9/1996 Output-: Present Age Years: 22 Months:11 Days: 26Approach used below is as follows −Input the current date and birth date of a personCheck for the conditionsIf current month is less than the birth month, then we will not consider the current year because this year has not been completed yet and to compute the differences in months by adding 12 to the current month.If the current date is less than the ... Read More
6K+ Views
A JSONObject is an unordered collection of a key, value pairs, and the values can be any of these types like Boolean, JSONArray, JSONObject, Number and String. The constructor of a JSONObject can be used to convert an external form JSON text into an internal form whose values can be retrieved with the get() and opt() methods or to convert values into a JSON text using the put() and toString() methods.In the below example, we can sort the values of a JSONObject in the descending order.Exampleimport org.json.*; import java.util.*; public class JSonObjectSortingTest { public static void main(String[] args) { ... Read More