Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles by Chandu yadav
Page 16 of 81
C# Program to filter array elements based on a predicate
Set an array.int[] arr = { 40, 42, 12, 83, 75, 40, 95 };Use the Where clause and predicate to get elements above 50.IEnumerable myQuery = arr.AsQueryable() .Where((a, index) => a >= 50);Let us see the complete code −Exampleusing System; using System.Linq; using System.Collections.Generic; public class Demo { public static void Main() { int[] arr = { 40, 42, 12, 83, 75, 40, 95 }; Console.WriteLine("Array:"); foreach (int a in arr) { Console.WriteLine(a); } // getting elements above 70 IEnumerable myQuery = arr.AsQueryable() .Where((a, index) => a >= 50); Console.WriteLine("Elements above 50...:"); foreach (int res in myQuery) { Console.WriteLine(res); } } }OutputArray: 40 42 12 83 75 40 95 Elements above 50...: 83 75 95
Read MoreBootstrap .radio-inline class
Use .radio-inline class to a series of radios for controls to appear on the same line. You can try to run the following code to implement the radio-inline class in Bootstrap −Example Bootstrap Forms Best Porgraming Language Java C C++
Read MoreWhat does the interface ICloneable do in C#?
The ICloneable interface creates a copy of the exisiting object i.e a clone.It only has a single method −Clone() − The clone() method creates a new object that is a copy of the current instance.The following is an example showing how to perform cloning using Icloneable interface −Exampleusing System; class Car : ICloneable { int width; public Car(int width) { this.width = width; } public object Clone() { return new Car(this.width); } public override string ToString() { return string.Format("Width of car ...
Read MoreC# Program to perform Currency Conversion
Let’s say you need to get the value of 10 dollars in INR.Firstly, set the variables: double usd, inr, val;Now set the dollars and convert it to INR.// how many dpllars usd = 10; // current value of US$ val = 69; inr = usd * val;Let us see the complete code −Exampleusing System; namespace Demo { public class Program { public static void Main(string[] args) { Double usd, inr, val; // how many dpllars usd = 10; // current value of US$ val = 69; inr = usd * val; Console.WriteLine("{0} Dollar = {1} INR", usd, inr); } } }Output10 Dollar = 690 INR
Read MoreHow to apply a 2D or 3D transformation to an element with CSS
Apply a 2D or 3D transformation to an element with the transform property in CSS. You can try to run the following code to rotate an element using transformationExample div { width: 200px; height: 100px; background-color: gray; transform: rotate(10deg); } Rotation Demo
Read MoreStyle <input> elements with a value within a specified range with CSS
To style elements with a value within a specified range, use the CSS :in-range selector. You can try to run the following code to implement the :in-range selectorExample input:in-range { border: 3px dashed orange; background: yellow; } The style only works for the value entered i.e. 9
Read MoreDisplay a blue shadow on image hover with CSS
To display a shadow on image hover, use the CSS box-shadow propertyExample img { border: 2px solid orange; border-radius: 3px; padding: 7px; } img:hover { box-shadow: 0 0 2px 2px blue; }
Read MoreModular multiplicative inverse in java
The java.math.BigInteger.modInverse(BigInteger m) returns a BigInteger whose value is (this-1 mod m). Using this method you can calculate Modular multiplicative inverse for a given number.Programimport java.math.*; public class BigIntegerDemo { public static void main(String[] args) { // create 3 BigInteger objects BigInteger bi1, bi2, bi3; // create a BigInteger exponent BigInteger exponent = new BigInteger("2"); bi1 = new BigInteger("7"); bi2 = new BigInteger("20"); // perform modPow operation on bi1 using bi2 and exp bi3 = bi1.modPow(exponent, bi2); String str = bi1 + "^" +exponent+ " mod " + bi2 + " is " +bi3; // print bi3 value System.out.println( str ); } }Output7^2 mod 20 is 9
Read MoreSet the color of the four borders using CSS
To set the color of the four borders, use the border-color property. You can try to run the following code to set border color for all the bordersExample p { border-style: dashed; border-color: #808000 #800000 #FF0000 #FFFF00; } This is demo text with four colored border. Output
Read MoreChange the background color of a button with CSS
To change the background color of a button, use the background-color property.You can try to run the following code to change button’s background colorExample .btn { background-color: yellow; color: black; text-align: center; font-size: 13px; } Result Click below for result: Result
Read More