## C# Program to Print the Sum of all the Multiples of 3 and 5

using System; namespace ConsoleApp2 { class Program { public static void Main() { int number, i, k, count = 1; Console.Write(“Enter number of rows\n”); number = int.Parse(Console.ReadLine()); count = number – 1; for (k = 1; k <= number; k++) { for (i = 1; i <= count; i++) Console.Write(” “); count–; for (i = […]

## Count the frequency of each element of an array

In this program, we will count the frequency of each element of an array. Example: Elements in the array [1,8,4,2,8,1,4,8,9,8] Output: 1 occurs 2 times 8 occurs 4 times 4 occurs 2 times 2 occurs 1 times 9 occurs 1 times   using System; namespace ConsoleApp2 { class Program { static void Main(string[] args) { […]

## Fibonacci Series in c#

The Fibonacci Series is a series where the next term is the sum of previous two terms. The first two terms of the Fibonacci Series is 0 followed by 1. The Fibonacci Series: 0, 1, 1, 2, 3, 5, 8, 13, 21. Example: using System; namespace ConsoleApp1 { class Program { static int FibonacciSeries(int n) […]

## Program to Check Armstrong Number

Here, we will Check Whether the entered number is an Armstrong Number or Not. An Armstrong number is a number such that the sum of its digits raised to the third power is equal to the number itself. For example, 371 is an Armstrong number, since  3**3 + 7**3 + 1**3 = 371. using System; namespace ConsoleApp1 { […]

## Program to check the number is palindrome or not.

A palindromic number or numeral palindrome is a number that remains the same when its digits are reversed. Like 16461, for example, it is “symmetrical”. The term palindromic is derived from palindrome, which refers to a word (such as rotor or racecar) whose spelling is unchanged when its letters are reversed. Example:   class Program […]

## Program to print ASCII characters

ASCII (American Standard Code for Information Interchange) is a character encoding standard (the Internet Assigned Numbers Authority (IANA) prefers the name US-ASCII. ASCII codes represent text in computers, telecommunications equipment, and other devices. Most modern character-encoding schemes are based on ASCII, although they support many additional characters. Exmple:   class Program { static void Main(string[] […]

## Program to Reverse the Number

In below program, I will reverse a number in c#.   class Program { static void Main(string[] args) { int num, rem, sum = 0, rev; Console.WriteLine(“\n /** To Find Reverse Of a Number **/”); Console.Write(“\n Enter a number: “); num = Convert.ToInt32(Console.ReadLine()); while (Convert.ToBoolean(num)) { rem = num % 10; //for getting remainder by […]

## Binary search tree or AVL tree

# Program to insert contents of file in Binary search tree or AVL tree # It calculates total time it took for the insertion of all the elements # It also calcultaes average height of the tree formed and height of any particaluar node # Average height is the average of lenghts of all the […]

## WAP to show saddle point

#include<stdio.h> #include<conio.h> void main() { int a = {1,2,3, 4,5,6, 7,8,9},i,j,k,value=0,temp=0,max=0; value = a; printf(“\n Matrix Is “); for(i=0;i < 3;i++) { printf(“\n”); for(j=0;j < 3;j++) { printf(“\t%d”,a[i][j]); } } for(i=0; i < 3;i++) { value = a[i]; for(k=0;k < 3;k++) { if(value > a[i][k]) { value = a[i][k]; temp = k; } } max […]

## WAP to convert Sparse matrix to original matrix

//Sparse to Original Type -I #include <stdio.h> #include <conio.h> void main() { int a = {0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0},i,j,k=1,sp = {5,5,4, 0,2,5, 2,0,2, 3,4,9, 4,0,3}; for(k=1;k<5;k++) { a[sp[k]][sp[k]] = sp[k]; } printf(“\n Original Matrix “); for(i=0;i<5;i++) { printf(“\n”); for(j=0;j<5;j++) { printf(“\t%d”,a[i][j]); } } getch(); }

## WAP to convert original matrix to Sparse matrix

#include <stdio.h> #include <conio.h> void main() { int a = {0,0,5,0,0, 0,0,0,0,0, 2,0,0,0,0, 0,0,0,0,9, 3,0,0,0,0},i,j,sp,k=1; sp = 5; sp = 5; sp = 4; for(i=0;i<5;i++) { for(j=0;j<5;j++) { if(a[i][j]!=0) { sp[k] = i; sp[k] = j; sp[k] = a[i][j]; k++; } } } printf(“\n Sparce Matrix “); for(i=0;i<5;i++) { printf(“\n”); for(j=0;j<3;j++) { printf(“\t%d”,sp[i][j]); } } […]

## Double Queue in Data Structure

#include <stdio.h> #include <conio.h> void main() { int CQ,i,front = -1,rear = -1,ch,x; do { printf(“\n 1:Insert “); printf(“\n 2:Delete”); printf(“\n 3:Display”); printf(“\n 0:Exit”); printf(“\n Enter your Choice “); scanf(“%d”,&ch); switch(ch) { case 1: if(front == 0 &&((rear == 9)||(rear+1 == front))) { printf(“\n Queue is Full”); break; } if(front == -1) front = rear […]