Found 26504 Articles for Server Side Programming

C Program to convert a given number to words

Sunidhi Bansal
Updated on 20-Nov-2019 10:45:22

12K+ Views

Given a string consisting of numerical values, the task is to covert those given numbers in words.Like we have an input “361”; then the output should be in words i.e, ” Three hundred sixty one”. For the solution of the following problem we have to keep in mind the numbers and places it is in on like ones, tens, thousands etc.The code only support upto 4 digits numbers i.e., 0 to 9999. So the input should be from 0 to 9999.Let us consider 1, 111 so the places will be like −ExampleInput: “1234” Output: one thousand two hundred thirty four ... Read More

Printing all subsets of {1,2,3,…n} without using array or loop in C program

Sunidhi Bansal
Updated on 20-Nov-2019 10:27:55

1K+ Views

Given a positive integer n we have to print all the subsets of a set of {1, 2, 3, 4, … n} without using any array or loops.Like we have given any number say 3 s we have to print all the subset in the set {1, 2, 3} which would be {1 2 3}, {1 2}, {2 3}, {1 3}, {1}, {2}, {3} { }.But we have to do this without using any loop or an array. So, only the recursion is the possible way to solve this type of problem without using any array or a loop.ExampleInput: 3 ... Read More

Program to check Strength of Password in C++

Sunidhi Bansal
Updated on 20-Nov-2019 10:14:56

7K+ Views

Given a string input containing password characters, the task is to check the strength of the password.The strength of the password is when you tell that the password is whether easily guessed or cracked. The strength should vary from weak, average and strong. To check the strength we have to check the following points −Password must be at least 8 characters long.It must contain 1 lower case alphabet.It must contain 1 uppercase alphabetIt must contain a digitIt must contain a special character like : !@#$%^&*()>= 8))          Print "Strong"       else if ((hasLower || hasUpper) ... Read More

Program to Convert Hexadecimal to Octal in C program

Sunidhi Bansal
Updated on 20-Nov-2019 10:05:51

2K+ Views

We are given a Hexadecimal number as string; the task is to convert it to the Octal. To convert a hexadecimal number to octal, we have to −Find the binary equivalent to the hexadecimal number.Convert the binary number to Octal.What are hexadecimal numbersHexadecimal numbers are the numbers which are of base of 16 the numbers vary from 0-9 and from 10 onwards the numbers are represented as A which represents 10, B for 11, C for 12, D for 13, E for 14, and F for 15.To convert hexadecimal number into binary number every number is converted into its binary ... Read More

Uri.HexEscape(Char) Method in C#

AmitDiwan
Updated on 14-Nov-2019 06:57:07

166 Views

The Uri.HexEscape() method in C# is used to convert a specified character into its hexadecimal equivalent.SyntaxFollowing is the syntax −public static string HexEscape (char ch);Above, the parameter ch is the character to convert to hexadecimal representation.ExampleLet us now see an example to implement the Uri.HexEscape() method −using System; public class Demo {    public static void Main(){       char ch = 'k';       string res = Uri.HexEscape(ch);       Console.WriteLine("Hexadecimal Equivalent = "+res);    } }OutputThis will produce the following output −Hexadecimal Equivalent = %6BExampleLet us now see another example to implement the Uri.HexEscape() method ... Read More

UInt32.GetHashCode() Method in C# with Examples

AmitDiwan
Updated on 14-Nov-2019 06:56:00

118 Views

The UInt32.GetHashCode() method in C# is used to get the HashCode for the current UInt32 instance.SyntaxFollowing is the syntax −public override int GetHashCode ();ExampleLet us now see an example to implement the UInt32.GetHashCode() method −using System; public class Demo {    public static void Main(){       uint val1 = 100;       uint val2 = UInt16.MinValue;       Console.WriteLine("HashCode for val1 = "+val1.GetHashCode());       Console.WriteLine("HashCode for val2 = "+val2.GetHashCode());    } }OutputThis will produce the following output −HashCode for val1 = 100 HashCode for val2 = 0ExampleLet us now see another example to implement ... Read More

How to change the WindowWidth of the Console in C#?

AmitDiwan
Updated on 14-Nov-2019 06:53:59

130 Views

Use the Console.WindowWidth Property to change the WindowWidth of the Console.ExampleLet us now see an example −using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Demo {    public static void Main (string[] args) {       Console.InputEncoding = Encoding.ASCII;       Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding);       Console.OutputEncoding = Encoding.ASCII;       Console.WriteLine("Output Encoding Scheme = "+Console.OutputEncoding);       Console.CursorVisible = false;       Console.Write("Cursor is Visible? "+ Console.CursorVisible);       Console.WindowWidth = 30;       Console.Write("WindowWidth = "+Console.WindowWidth);    } } OutputThis will produce the following ... Read More

How to change the WindowTop of the Console in C#?

AmitDiwan
Updated on 14-Nov-2019 06:52:56

139 Views

Use the Console.WindowTop Property to change the WindowTop of the Console in C#.ExampleLet us now see an example −using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Demo {    public static void Main (string[] args) {       Console.InputEncoding = Encoding.ASCII;       Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding);       Console.OutputEncoding = Encoding.ASCII;       Console.WriteLine("Output Encoding Scheme = "+Console.OutputEncoding);       Console.CursorVisible = false;       Console.Write("Cursor is Visible? "+ Console.CursorVisible);       Console.WindowTop = 40;       Console.Write("WindowTop = "+Console.WindowTop);    } }OutputThis will produce the following ... Read More

UInt32.Equals() Method in C# with Examples

AmitDiwan
Updated on 14-Nov-2019 06:51:30

145 Views

The UInt32.Equals() method in C# returns a value indicating whether this instance is equal to a specified object or UInt32.SyntaxFollowing is the syntax −public override bool Equals (object ob); public bool Equals (uint ob);Above, the parameter ob for the 1st syntax is an object to compare to this instance and the parameter ob for the 2nd syntax is the 32-bit unsigned integer to compare to this instance.ExampleLet us now see an example to implement the UInt32.Equals() method −using System; public class Demo {    public static void Main(){       uint val1 = 52;       uint val2 ... Read More

UInt32.CompareTo() Method in C# with Examples

AmitDiwan
Updated on 14-Nov-2019 06:49:45

335 Views

The UInt32.CompareTo() method in C# is used to compare the current instance to a specified object or UInt32 and returns an indication of their relative values.SyntaxFollowing is the syntax −public int CompareTo (object val); public int CompareTo (uint val;Above, the Val for the 1st syntax is an object to compare. The Val for 2nd syntax is an unsigned integer to compare.The return value is 0 if the current instance is equal to value. It’s less than zero if the current instance is less than Val. The return value is more than zero if the current instance is greater than Val.ExampleLet ... Read More

Advertisements