Ankith Reddy has Published 1070 Articles

How to import styles from another style sheet in CSS

Ankith Reddy

Ankith Reddy

Updated on 13-Mar-2020 13:12:01

277 Views

To import styles from another style, use the @import rule. It should appear right at the start of the style sheet before any of the rules, and its value is a URL.You can write it like this     The significance of the @import rule is that it allows you ... Read More

Java Program to Convert contents of a file to byte array and Vice-Versa

Ankith Reddy

Ankith Reddy

Updated on 13-Mar-2020 12:56:11

192 Views

The FileInputStream class contains a method read(), this method accepts a byte array as a parameter and it reads the data of the file input stream to given byte array. Assume the file myData contains the following data −Exampleimport java.io.File; import java.io.FileInputStream; public class FileToByteArray {    public static ... Read More

Java program to accept an integer from user and print it

Ankith Reddy

Ankith Reddy

Updated on 13-Mar-2020 10:46:39

750 Views

Scanner class of the util package class is used to read data from user The nextInt() method of this class reads an integer from the user.Programimport java.util.Scanner; public class PrintInteger {    public static void main(String args[]){       Scanner sc = new Scanner(System.in);       System.out.println("Enter an ... Read More

Java program to print the fibonacci series of a given number using while loop

Ankith Reddy

Ankith Reddy

Updated on 13-Mar-2020 09:51:11

2K+ Views

Fibonacci Series generates subsequent number by adding two previous numbers. Fibonacci series starts from two numbers − F0 & F1. The initial values of F0 & F1 can be taken 0, 1 or 1, 1 respectively.ExampleLive Demopublic class FibonacciSeriesWithWhileLoop{    public static void main(String args[]) {       int ... Read More

Java program to reverse a string using recursion

Ankith Reddy

Ankith Reddy

Updated on 13-Mar-2020 07:00:25

842 Views

Recursion is the process of repeating items in a self-similar way. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the function. You can reverse a string using the recursive function as shown in the ... Read More

Java program to Print Odd and Even Number from an Array

Ankith Reddy

Ankith Reddy

Updated on 13-Mar-2020 06:18:02

1K+ Views

In the loop check, the result of I %2 operation on each element, if 0 the element is even else the element is odd.ExampleLive Demopublic class OddNumbersInAnArray {    public static void main(String args[]){       int[] myArray = {23, 93, 56, 92, 39};       System.out.println("Even numbers in the given array are:: ");       for (int i=0; i

Java program to print the factorial of the given number

Ankith Reddy

Ankith Reddy

Updated on 13-Mar-2020 05:36:50

4K+ Views

Factorial of a positive integer n is the product of all values from n to 1. For example, the factorial of 3 is (3 * 2 * 1 = 6). Algorithm1. Take integer variable A 2. Assign a value to the variable 3. From value, A up to 1 multiply each ... Read More

How to generate pyramid of numbers using Python?

Ankith Reddy

Ankith Reddy

Updated on 05-Mar-2020 11:11:42

679 Views

There are multiple variations of generating pyramids using numbers in Python. Let's look at the 2 simplest formsExamplefor i in range(5):    for j in range(i + 1):       print(j + 1, end="")    print("")OutputThis will give the output1 12 123 1234 12345ExampleYou can also print numbers continuously ... Read More

How to Display the multiplication Table using Python?

Ankith Reddy

Ankith Reddy

Updated on 05-Mar-2020 10:36:28

305 Views

You can create the multiplication table for any number using a simple loop. exampledef print_mul_table(num):    for i in range(1, 11):       print("{:d} X {:d} = {:d}".format(num, i, num * i)) print_mul_table(5)OutputThis will give the output5 X 1 = 5 5 X 2 = 10 5 X 3 = ... Read More

How to find time difference using Python?

Ankith Reddy

Ankith Reddy

Updated on 05-Mar-2020 10:19:02

1K+ Views

It is very easy to do date and time maths in Python using time delta objects. Whenever you want to add or subtract to a date/time, use a DateTime.datetime(), then add or subtract date time.time delta() instances. A time delta object represents a duration, the difference between two dates or ... Read More

Advertisements