Tag: tutorials

C Program to add two integers

Problem Write a program in C to add two integers and display the result on the screen. C Program to add two integers Output Enter first number : 1                                                                                                                                                            Enter second number : 2                                                                                                                                                                  1 + 2 = 3

How to Generate Links to Action Method in different Areas in ASP.NET MVC?

The ActionLink helper method has 9+ overloads to generate links based on various scenarios. Generally, the “Action Name” is passed as the 2nd parameter to the ActionLink which points to the current Controller and the specified Action method. What do we do when the Action method of a different Area needs to be refereed to when generating the link in ASP.NET MVC? How to Generate…

Keywords in Java

Below are some of the well known keywords in Java Keywords in Java abstractassertbooleanbreakbytecasecatchcharclassconstcontinuedefaultdodoubleelseenumextendsfinalfinallyfloatforgotoifimplementsimportinstanceofintinterfacelongnativenewpackageprivateprotectedpublicreturnshortstaticstrictfpsuperswitchsynchronizedthisthrowthrowstransienttryvoidvolatilewhile

Property Elements Example in Xaml for Simple Properties

In Xaml , you can use the property element for simple properties as well . For example , you can set the Height and width of the Button control in Xaml using the property element syntax instead of attributes. Below is the sample code snippet demonstrating this. Property Elements Example in Xaml for Simple Properties

What is the Difference between String and String Builder in C#?

What is the Difference between String and String Builder in C#? The string instance is immutable i.e. each time when you change the string m a new instance is returned. This can be inefficient sometimes The StringBuilder allows the developers to have a mutable string. This is a good option in case you want to modify / append string many times.

Url.Action in ASP.NET MVC

The Url.Action method in ASP.NET MVC allows the developers to generate the fully qualified URL to an action method. It is defined in the namespace System.Web.Mvc. The Url.Action generates only the URL unlike the Html.ActionLink. Url.Action in ASP.NET MVC Below is a code snippet of the View demonstrating the Url.Action

How to Sort Array Elements in Ascending Order in C#?

The Array class includes static method called Sort which can be used to sort the array in ascending order in C#. Array.Sort(<arry>); How to Sort Array Elements in Ascending Order in C#? Below is a sample code snippet demonstrating sorting of array elements in ascending order in C#.

Java – How to Check if a string is a valid number?

Problem statement You need to check if a input string contain a valid number or not. Solution Use the appropriate wrapper class for converting the string to numeric formats. For example Double to convert string to double as shown below. When the input is a invalid number , the NumberFormatException is caused which needs to be handled by the developers.

C Program to display half-pyramid using numbers

Problem Write a program in C to print  half-pyramid using numbers as shown.The program should take the number of rows as input. 1 1 2 1 2 3 1 2 3 4 How to create and display half-pyramid pattern in C using numbers? Output Abundantcode.com Coding samples Enter the No. of rows:4 1 1 2 1 2 3 1 2 3 4

How to sort an array using Comparator in Java ?

The Arrays.sort method in java lets the developers to sort an array of objects. The sort method also accepts the comparator object which can contain the sorting logic. How to sort an array using Comparator in Java ? Below is a sample code snippet demonstrating the usage of the Arrays.sort method with the comparator.

SelectMany Example in LINQ and C#

Below is a sample source code demonstrating the usage of the SelectMany method in LINQ and C#. One of the usage of the SelectMany is to return the flat list an avoid returning the lists of lists. SelectMany Example in LINQ and C#

C Program to find the ASCII Value of a Character

Problem Write a program in C to find the Ascii value of a character entered by the user and display the result on the screen. How to find the ASCII Value of a Character in C ? When the user enters the character A , the value 65 (Ascii value) should be displayed on the screen. Here’s a C program for it. Output Enter a…

C Program to display inverted full pyramid using *

Problem Write a program in C to print inverted full pyramid using * as shown below.The program should take the number of rows as input. * * * * * * *     * * * * *       * * *         * How to create and display inverted full pyramid using * ? Output Abundantcode.com Coding samples Enter number of rows: 4 *…

C Program to find if a character is a Vowel or Consonant

Problem Write a program in C to check whether a given character is a vowel or consonant. How to check if a character is a vowel or consonant in C Language ? In English , the alphabets A, E, I, O and U are vowels and the rest of the characters are consonants. Here’s a program that takes an input character from the user and…

C Program to Multiply two Floating Point Numbers

Problem Write a program in C to multiply two floating point numbers and then display the output on the console window. C Program to Multiply two Floating Point Numbers Output Enter two numbers: 6 7                                                                                                                                                        Product = 42.00