Sharon Christine has Published 413 Articles

C Program to Add two Integers

Sharon Christine

Sharon Christine

Updated on 30-Jul-2019 22:30:26

1K+ Views

A program to add two numbers takes to numbers and does their mathematical sum and gives it to another variable that stores its sum.Example Code Live Demo#include int main(void) {    int a = 545;    int b = 123;    printf("The first number is %d and the second number ... Read More

Sum of first N natural numbers which are divisible by X or Y

Sharon Christine

Sharon Christine

Updated on 30-Jul-2019 22:30:26

656 Views

Adding up all natural numbers up to n, that are divisible by X or Y is selecting all the numbers that are divisible by X or Y and adding them to a variable that stores the sum.To find the sum of the first N natural numbers which are divisible by ... Read More

Area of the largest triangle that can be inscribed within a rectangle?

Sharon Christine

Sharon Christine

Updated on 30-Jul-2019 22:30:26

586 Views

A rectangle is a quadrilateral that has opposite side equal and parallel. The adjacent side are at 90o. And a triangle is a closed figure with three sides.The largest triangle inscribed within a rectangle. Has its base equal to the length of the rectangle and height of the triangle is ... Read More

Power Function in C/C++

Sharon Christine

Sharon Christine

Updated on 30-Jul-2019 22:30:26

1K+ Views

Power function is used to calculate the power of the given number.The pow function find the value of a raised to the power b i.e. ab.Syntaxdouble pow(double a , double b)It accepts a double integers as input and output a double integer as output. It pow() function is defined in ... Read More

Average of Squares of Natural Numbers?

Sharon Christine

Sharon Christine

Updated on 30-Jul-2019 22:30:26

3K+ Views

The average of the square of Natural Number is calculated by adding all the squares up to n natural numbers and then dividing it by the number.SampleAverage of square of first 2 natural numbers is 2.5 ,12 + 22 = 5 => 5/2 = 2.5.There are two methods for calculating ... Read More

Area of circle inscribed within rhombus?

Sharon Christine

Sharon Christine

Updated on 30-Jul-2019 22:30:26

3K+ Views

Circle inscribed in a rhombus touches its four side a four ends. The side of rhombus is a tangent to the circle.Here, r is the radius that is to be found using a and, the diagonals whose values are given.Now the area of triangle AOB = ½ * OA * ... Read More

HTML DOM paddingLeft Property

Sharon Christine

Sharon Christine

Updated on 30-Jul-2019 22:30:26

112 Views

The HTML DOM paddingLeft property returns and add left padding to an HTML element.SyntaxFollowing is the syntax −1. Returning left paddingobject.style.paddingLeft2. Adding left paddingobject.style.paddingLeft=”value”ValuesHere, “value” can be the following −ValueDetailslengthIt defines value padding in length unit.initialIt defines padding to its default value.inheritIn this padding gets inherited from its parent element.percentage(%)It ... Read More

JavaTuples setAt0() method for Triplet class

Sharon Christine

Sharon Christine

Updated on 30-Jul-2019 22:30:25

130 Views

The setAt0() method is used to set the Triplet value in JavaTuples and a copy with new value at the specified index i.e. index 0 here.Let us first see what we need to work with JavaTuples. To work with Triplet class in JavaTuples, you need to import the following package ... Read More

DecimalFormat("0.######E0") in Java

Sharon Christine

Sharon Christine

Updated on 30-Jul-2019 22:30:24

123 Views

DecimalFormat is a concrete subclass of NumberFormat that formats decimal numbers. Let us set DecimalFormat("0.######E0") and use the format() method as well −new DecimalFormat("0.######E0").format(298757)Since, we have used DecimalFormat class in Java, therefore importing the following package in a must −import java.text.DecimalFormat;The following is the complete example −Example Live Demoimport java.text.DecimalFormat; public ... Read More

What are Java methods equivalent to C# virtual functions?

Sharon Christine

Sharon Christine

Updated on 30-Jul-2019 22:30:22

535 Views

All instance methods in Java are virtual except, static methods and private methods.

Advertisements