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
-
Economics & Finance
Articles by karthikeya Boyini
Page 65 of 143
C# program to count upper and lower case characters in a given string
To count uppercase characters in a string, check the following condition −myStr[i]>='A' && myStr[i]='a' && myStr[i]
Read MoreC# program to replace all spaces in a string with '%20'
We have a sample string with spaces −str ="Hello World !";Use the Replace() method in C# to replace all spaces in a string with ‘%20’ −str2 = str.Replace(" ", "%20");ExampleYou can try to run the following code to replace all spaces in a string with ‘%20’.using System; class Demo { static void Main() { String str, str2; str ="Hello World !"; Console.WriteLine("String: "+str); str2 = str.Replace(" ", "%20"); Console.WriteLine("String (After replacing): "+str2); } }OutputString: Hello World ! String (After replacing): Hello%20World%20!
Read MoreSet the width of an element to 25% in Bootstrap
To set the width of an element to 25%, use the .w-25 class in Bootstrap.You can try to run the following code to set element’s widthExample Bootstrap Example Set element width Normal width Width is 50% Width is 25%
Read MoreC# Program to Illustrate Lower Triangular Matrix
For the lower triangular matrix, set all the elements above the main diagonal to zero.Set the following condition −if (i >= j) Console.Write(A[i, j] + "\t"); else Console.Write("0\t");ExampleYou can try to run the following code to display a lower triangular matrix.using System; using System.Linq; class Demo { static void Main() { int m, n, i, j; Console.Write("Enter number of rows and columns of the matrix "); m = Convert.ToInt16(Console.ReadLine()); n = Convert.ToInt16(Console.ReadLine()); int[, ] A = new int[10, 10]; ...
Read MoreC# Program to Kill a Thread
Create a thread first and start it −// new thread Thread thread = new Thread(c.display); thread.Start();Now display the thread and set a stop function to stop the working of the thread −public void display() { while (!flag) { Console.WriteLine("It's Working"); Thread.Sleep(2000); } } public void Stop() { flag = true; } }ExampleThe following is the complete code to learn how to kill a thread in C#.using System; using System.Threading.Tasks; using System.Threading; class Demo { static void Main(string[] args){ MyClass c = new MyClass(); ...
Read MoreSet the width of an element to 100% in Bootstrap
To set the width of an element to 100%, use the .w-100 class in Bootstrap.You can try to run the following code to set element’s widthExample Bootstrap Example Set element width Normal width Width is 25%
Read MoreC# program to find the maximum of three numbers
Firstly, let’s set the three numbers −int num1, num2, num3; // set the value of the three numbers num1 = 10; num2 = 20; num3 = 50;Now check the first number with the second number. If num1 > num2, then check num1 with num3. If num1 is greater than num3, that would mean the largest number is num1.ExampleYou can try to run the following code to find the maximum of three numbers.using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Demo { class MyApplication { static void Main(string[] args) { int num1, ...
Read MoreC# Program to Create a Thread Pool
For a thread pool, create more than two functions and queue methods for execution.Firstly, create a method like −public void one(object o) { for (int i = 0; i
Read MoreAddition and Concatenation in Java
'+' operator in java can be used to add numbers and concatenate strings. Following rules should be considered.Only numbers as operands then result will be a number.Only strings as operands then result will be a concatenated string.If both numbers and strings as operands, then numbers coming before string will be treated as numbers.If both numbers and strings as operands, then numbers coming after string will be treated as a string.Above rule can be overridden using brackets().ExampleCreate a java class named Tester.Tester.javapublic class Tester { public static void main(String args[]) { //Scenario 1: Only ...
Read MoreC# program to find the sum of digits of a number using Recursion
Let’s say we have set the number for which we will find the sum of digits −int val = 789; Console.WriteLine("Number:", val);The following will find the sum of digits by entering the number and checking it recursively −public int addFunc(int val) { if (val != 0) { return (val % 10 + addFunc(val / 10)); } else { return 0; } }ExampleThe following is our code to find the sum of digits of a number using Recursion in C#.using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Demo { class ...
Read More