Sunidhi Bansal

Sunidhi Bansal

809 Articles Published

Articles by Sunidhi Bansal

Page 69 of 81

C Program for Circumference of a Parallelogram

Sunidhi Bansal
Sunidhi Bansal
Updated on 09-Jul-2020 235 Views

We are given with the sides of parallelogram and the task is to generate the circumference of a parallelogram with its given sides and display the resultWhat is a Parallelogram?Parallelogram is a type of quadratic which have −Opposite sides parallelOpposite angles equalPolygon diagonals bisects each otherShown in the below figure ‘a’ and ‘b’ are the sides of a parallelogram where parallel sides are shown in the figure.Perimeter/Circumference of a parallelogram is defined as −Circumference of Parallelogram = 2(a + b)                                           ...

Read More

C++ Program for class interval arithmetic mean

Sunidhi Bansal
Sunidhi Bansal
Updated on 09-Jul-2020 736 Views

We are given with three arrays where first array contains the upper limit for arithmetic mean, second array contains the lower limit for arithmetic mean and third array contains the frequencies and the task is to generate the arithmetic mean of class intervals given.What is Arithmetic Mean?Arithmetic mean is the average value that is calculated by dividing the sum of all the elements in the set with the total number of elements in the given set.How to calculate Class Interval Arithmetic MeanGiven with Lower Limit, Upper Limit, FrequencyLower LimitUpper LimitFrequency121342563784Calculate the mid-point by adding the upper limit and lower limit ...

Read More

C++ Program for triangular pattern (mirror image around 0)

Sunidhi Bansal
Sunidhi Bansal
Updated on 09-Jul-2020 386 Views

Given with the positive value n and the task is to generate the triangular pattern i.e. mirror image of the printed numbers and display the resultExampleInput-: n = 6 Output-:Input-: n = 3 Output-:Approach used in the below program is as follows −Input the value of n as a positive integerTraverse one loop i for the number of rows in a pattern i.e. nTraverse one loop j for the number of spaces in a patternTraverse another loop for the digits in a patternAlgorithmSTART Step 1-> declare function to print mirror image of triangular pattern    void print_mirror(int n)    declare ...

Read More

C++ program for Find sum of odd factors of a number

Sunidhi Bansal
Sunidhi Bansal
Updated on 09-Jul-2020 613 Views

Given with a positive integer and the task is to generate the odd factors of a number and finding out the sum of given odd factors.ExampleInput-: number = 20 Output-: sum of odd factors is: 6 Input-: number = 18 Output-: sum of odd factors is: 13So, result = 1 + 5 = 6Approach used in the below program is as follows −Input the number for calculating the sum of odd factors of that numberIgnore the digit 0 and 2 because both are even digits and store the digit 1 because it is an odd digitStart the loop from 3 ...

Read More

Print system time in C++ (3 different ways)

Sunidhi Bansal
Sunidhi Bansal
Updated on 02-Jul-2020 13K+ Views

There are different ways by which system day, date and time can be printed in Human Readable Form.First wayUsing time() − It is used to find the current calendar time and have arithmetic data type that store timelocaltime() − It is used to fill the structure with date and timeasctime() − It converts Local time into Human Readable FormatDay Month Date hour:month:second YearExample#include #include // used to work with date and time using namespace std; int main() {    time_t t; // t passed as argument in function time()    struct tm * tt; // decalring variable for localtime()   ...

Read More

Print triplets with sum less than or equal to k in C Program

Sunidhi Bansal
Sunidhi Bansal
Updated on 01-Jul-2020 205 Views

Given array with set of elements and the task is to find out set with exactly three elements having sum less than or equals to k.Input − arr[]= {1, 2, 3, 8, 5, 4}Output − set → {1, 2, 3} {1, 2, 5} {1, 2, 4} {1, 3, 5} {1, 3, 4} {1, 5, 4} {2, 3, 5} {2, 3, 4}In this, first task is to calculate the size of array depending upon which for loop of i is iterated till size-2 and for loop of j is iterated till size-1 and for loop of k is iterated till sizeAlgorithSTART Step 1 ...

Read More

Count divisors of n that have at-least one digit common with n in Java

Sunidhi Bansal
Sunidhi Bansal
Updated on 06-Jun-2020 262 Views

We are given with a number let’s say, num and the task is to calculate the divisor of a given number thereby count the divisors of num that have at least one digit common with n.Input − num = 24Output − Count is 4Explanation − we will perform the following steps −Firstly, calculate the divisors of a given numberDivisors of 24 are − 1, 2, 3, 4, 6, 8, 12, 24Secondly, check which divisor have at least one digit that matches with the digits of a number2, 4, 12, 24 are the divisors that contain the digit that matches with ...

Read More

Count no. of characters and words in a string in PL/SQL

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-May-2020 2K+ Views

We are given a string of any length and the task is to calculate the count of characters and words in a string using PL/SQL.PL/SQL is a combination of SQL along with the procedural features of programming languages.It was developed by Oracle Corporation in the early 90's to enhance the capabilities of SQL. PL/SQL is one of three key programming languages embedded in the Oracle Database, along with SQL itself and Java.In PL/SQL block, we have DECLARE block which is used to declare the variables used in programming and we have BEGIN block where we write the logic for the ...

Read More

Convert distance from km to meters and centimeters in PL/SQL

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-May-2020 703 Views

The task is to convert the distance from kilometers to meters and centimeters in PL/SQL.PL/SQL is the extension of SQL which combines the Data manipulation of SQL with the working of procedural language.According to the problem we should have distance in kilometers whose value we have to convert in meters and centimeters.As per the conversion rule −1km = 1000 meters1km = 100000 centimetersAccording to this conversion rule we want the distance to be converted by a logic in PL/SQL.ExampleInput: kilometer = 10 Output: meter = 10000    Centimeter = 1000000 Input: kilometer = 9 Output: meter = 9000    Centimeter ...

Read More

Data types ranges and their macros in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 23-Mar-2020 336 Views

Given the task is to find the memory range of the different data types, that what range of value a data type can store the value from minimum value to maximum value. There is memory range of data type from in which value of data can be stored. It is difficult to remember the large range of value so C++ has macros for represent these numbers, from macros these large numbers can be directly assigned to variable without typing the whole Number range. Example 'char'(signed) is character data type and has a range of -128 to +128 and ...

Read More
Showing 681–690 of 809 articles
« Prev 1 67 68 69 70 71 81 Next »
Advertisements