Print Multiple Blank Lines in C#

George John
Updated on 22-Jun-2020 09:14:20

828 Views

To display multiple blank lines, we will take a while loop.Here, we are printing 10 blank lines using Console.WriteLine();while (a < 10) {    Console.WriteLine(" ");    a++; }The following is the complete code to display multiple blank lines −Exampleusing System; namespace Program {    public class Demo {       public static void Main(String[] args) {          int a = 0;          while (a < 10) {             Console.WriteLine(" ");             a++;          }          Console.WriteLine("Displayed 10 blank lines above!");          Console.ReadLine();       }    } }

Get Max Occurred Character in a String using C#

karthikeya Boyini
Updated on 22-Jun-2020 09:13:02

862 Views

To get the maximum occurred character in a string, loop until the length of the given string and find the occurrence.With that, set a new array to calculate −for (int i = 0; i < s.Length; i++)    a[s[i]]++; }The values we used above −String s = "livelife!"; int[] a = new int[maxCHARS];Now display the character and the occurrence −for (int i = 0; i < maxCHARS; i++)    if (a[i] > 1) {       Console.WriteLine("Character " + (char) i);       Console.WriteLine("Occurrence = " + a[i] + " times");    }Let us see the complete code ... Read More

Check If a String Contains a Certain Word in C#

Samual Sam
Updated on 22-Jun-2020 09:12:21

17K+ Views

Use the Contains() method to check if a string contains a word or not.Set the string −string s = "Together we can do so much!";Now let’s say you need to find the word “much”if (s.Contains("much") == true) {    Console.WriteLine("Word found!"); }Let us see the complete code −Example Live Demousing System; public class Demo {    public static void Main() {       string s = "Together we can do so much!";       if (s.Contains("much") == true) {          Console.WriteLine("Word found!");       } else {          Console.WriteLine("Word not found!");       }    } }OutputWord found!

Check If an Item Exists in a Chash Array

Ankith Reddy
Updated on 22-Jun-2020 09:11:45

5K+ Views

Use the Equals method to check if an item exists in a C# array.Set string and substring −string subStr = "pqrs"; string[] str = {    "abcd",    "ijkl",    "pqrs",    "wxyz" };Now check whether the substring is part of the string or not using the Equals method.if (item.Equals(subStr)) {    Console.WriteLine("Item Found"); }Here is the complete code −Example Live Demousing System; namespace Program {    public class Demo {       public static void Main(String[] args) {          string subStr = "pqrs";          string[] str = {             "abcd",             "ijkl",             "pqrs",             "wxyz"          };          foreach(string item in str) {             if (item.Equals(subStr)) {                Console.WriteLine("Item Found");             }          }       }    } }OutputItem Found

Why We Can't Use Arrow Operator in gets and puts

Pythonista
Updated on 22-Jun-2020 09:11:02

191 Views

You can't read user input in an un-initialized pointer. Instead, have a variable of the struct data type and assign its address to pointer before accessing its inner elements by → operatorexample#include struct example{    char name[20]; }; main(){    struct example *ptr;    struct example e;    puts("enter name");    gets(e.name);    ptr=&e;    puts(ptr->name); }OutputTypical result of above codeenter name Disha You entered Disha

Check if an Item Exists in a Chash List Collection

Arjun Thakur
Updated on 22-Jun-2020 09:09:58

14K+ Views

Set a list −List < string > list1 = new List < string > () {    "Lawrence",    "Adams",    "Pitt",    "Tom" };Now use the Contains method to check if an item exits in a list or not.if (list1.Contains("Adams") == true) {    Console.WriteLine("Item exists!"); }The following is the code to check if an item exists in a C# list or not.Exampleusing System; using System.Collections.Generic; public class Program {    public static void Main() {       List < string > list1 = new List < string > () {          "Lawrence",   ... Read More

Export List of All SAP HANA Systems in XML File

SAP Expert
Updated on 22-Jun-2020 09:09:25

926 Views

Yes, it is possible to export a list of your SAP HANA systems from the SAP HANA studio as an XML file and then it can be imported to another instance of the SAP HANA studio or use it as a system archive to which other users can link.This can be performed by following below steps −From the main menu, select File Export... .Expand the SAP HANA folder and choose Landscape.Choose Next.Select the systems you want to export and enter a target file location.Choose Finish

Print the First Ten Fibonacci Numbers Using C#

karthikeya Boyini
Updated on 22-Jun-2020 09:09:04

783 Views

For displaying the first ten numbers, firstly set the first two numbers.int val1 = 0, val2 = 1;Now, use a for loop from 2 to 10, to display first ten Fibonacci numbers −for(i=2;i

Print One-Dimensional Array in Reverse Order

Ankith Reddy
Updated on 22-Jun-2020 09:08:24

543 Views

Firstly, declare and initialize one dimensional array.int[] arr = { 35, 12, 66, 90, 34, 2, 64 };Now, use the following to reverse −Array.Reverse(arr);The following is the complete code to reverse a one-dimensional array;Example Live Demousing System; class Demo {    static void Main() {       int[] arr = { 76, 12, 66, 90, 34, 2, 64 };       // Initial Array       Console.WriteLine("Original Array= ");       foreach (int i in arr) {          Console.WriteLine(i);       }       // Reverse Array       Array.Reverse(arr);       Console.WriteLine("Reversed Array= ");       foreach (int j in arr) {          Console.WriteLine(j);       }       Console.ReadLine();    } }OutputOriginal Array= 76 12 66 90 34 2 64 Reversed Array= 64 2 34 90 66 12 76

Comparison of SAP HANA with Conventional Database

Anil SAP Gupta
Updated on 22-Jun-2020 09:07:45

384 Views

All the database objects in SAP HANA system are maintained in the CATALOG folder in HANA Studio. Following are the key capabilities of SAP HANA database system −You can use a high-performance in-memory database for processing complex transactions and analytics. You can manage large database volumes in multitenant database containers.Using SAP HANA in-memory database component, you can run advanced analytical queries that are complex in nature that too with high-speed transactions to get the correct, up-to-date responses in a fraction of a second. SAP HANA in-memory db system removes the need of predefined aggregates, materialized views, and removes data duplicity ... Read More

Advertisements