Posts

Showing posts from February, 2018

Write C# code to convert infix notation to postfix notation.

Image
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace InfixToPostfix {     class Program     {         static bool convert(ref string infix, out string postfix)         {             int prio = 0;             postfix = "";             Stack<Char> s1 = new Stack<char>();             for (int i = 0; i < infix.Length; i++)             {                 char ch = infix[i];                 if (ch == '+' || ch == '-' || ch == '*' || ch == '/')                 {                     if (s1.Count <= 0)           ...

Write a C# code to Perform Celsius to Fahrenheit Conversion and Fahrenheit to Celsius conversion.

Image
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace program {     class Program     {         static void Main (string[] args )         {              int celsius, faren;             Console.WriteLine("Enter Temperature in Celsius(°C) : ");             celsius = int.Parse(Console.ReadLine());             faren = (celsius * 9) / 5 + 32;             Console.WriteLine("Temperature in Fahrenheit is(°F) : " + faren);             Console.ReadLine();             double cel;             Console.Write("Enter Temperature in Fahrenheit(°F) : ");     ...

Write C# code to 1.Convert binary to decimal 2.Convert decimal to hexadecimal 3.Convert decimal to binary 4.Convert decimal to octal

Image
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Conversion {     class Program     {         static void Main(string[] args)         {             while (true)             {                 Console.WriteLine("Enter your Choice : ");                 Console.WriteLine("1. Binary to Decimal");                 Console.WriteLine("2. Decimal to Hexadecimal");                 Console.WriteLine("3. Decimal to Binary");                 Console.WriteLine("4. Decimal to octal");                 Console.WriteLine("5. All");               ...

Write a C# code to Convert following currency conversion.
Rupees to dollar, franc, euro.

Image
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CurrencyConversion {     class Program     {         static void Main(string[] args)         {             int choice;             Console.WriteLine("Enter your Choice :\n 1- Rupees to Dollar \n 2- Rupees to Euro \n 3- Rupees to Franc ");             choice = int.Parse(Console.ReadLine());             switch (choice)             {                 case 1:                     Double dollar, rupee, val;                     Console.WriteLine("Enter the Rupees Amount :");                 ...

Write a C# code to convert digits to words

Image
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DigitToWord {     class Program     {         static void Main(string[] args)         {             int num;             int nextdigit;             int numdigits;             int[] n = new int[20];             string[] digits = { "zero","one","two", "three","four","five", "six","seven","eight","nine"};             Console.WriteLine("Enter the number: ");             num = Convert.ToInt32(Console.ReadLine());             Console.WriteLine("Number: " + num);             Console.Write("Number in words: ");           ...

Write a program to increase and decrease font size programmatically.

Image
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Windows.Forms; namespace WindowsFormsApplication3 {     public partial class Form2 : Form     {         public Form2()         {             InitializeComponent();         }         static public Font ChangeFontSize(Font font, float fontsize)         {             if (font != null)             {                 float currentsize = font.Size;      ...

Write a program to Enable-Disable Textbox and change width of TextBox programmatically in Asp.Net.

Image
Design: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> </head> <body>     <form id="form1" runat="server">     <div>          <asp:TextBox ID="TextBox1" runat="server" Width="180px"></asp:TextBox>         <br />          <asp:Button ID="btnenable" runat="server" onclick="btnenable_Click" Text="Enable" />         <asp:Button ID="btndisable" runat="server" onclick="btndisable_Click" Text="Disable" />         <asp:Button ID="btnchange" runat="server" onclick="btndisable_Click" Text="ChangeWidth" /...