using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Logicals { class Program { static void Main(string[] args) { Console.WriteLine("Enter Number Only.."); int num = int.Parse(Console.ReadLine()); if (num % 2 == 0) { Console.WriteLine("It's a Even No.."); } else { Console.WriteLine("Its a Odd No.."); } Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Logicals { class TrianglePattern { static void Main(string[] args) { Console.WriteLine("Enter Number of Rows u want Only.."); int num = int.Parse(Console.ReadLine()); for (int i = 1; i <= num; i++) { for (int space = 1; space <= num - i; space++) { Console.Write(" "); } for (int j = 1; j <= 2 * i - 1; j++) { Console.Write(j); } Console.WriteLine(); }
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Logicals { class Pallindromnumber { static void Main(string[] args) { Console.WriteLine("Enter Number nOly.."); int num = int.Parse(Console.ReadLine()); int reminder, pallindrom = 0; int store = num; while (num > 0) { reminder = num % 10; pallindrom = pallindrom * 10 + reminder; num = num / 10;
} if (pallindrom == store) { Console.WriteLine("It's a Pallindrom No.."); } else { Console.WriteLine("It's Not a Pallindrom No.."); }
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Logicals { class Armstrongnumber { static void main(string[] args) { Console.WriteLine("Enter Number Only.."); int num = int.Parse(Console.ReadLine()); int reminder,armstrong=0; int store = num; while (num > 0) { reminder = num % 10; armstrong = armstrong + reminder * reminder * reminder; num = num / 10;
} if (armstrong == store) { Console.WriteLine("It's an Armstrong No.."); } else { Console.WriteLine("It's Not an Armstrong No.."); }
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Logicals { class Primenumber { static void Main(string[] args) { Console.WriteLine("Enter Number Only.."); int num = int.Parse(Console.ReadLine()); int count=0; for (int i = 2; i <= num;i++ ) { if (num % i == 0) { count++; } } if (count == 1) { Console.WriteLine("It's a Prime No.."); } else { Console.WriteLine("It's Not a Prime No.."); } Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Logicals { class FibonassiSeries { static void Main(string[] args) { Console.WriteLine("Enter Number Only.."); int num = int.Parse(Console.ReadLine()); int temp,a=0,b=1; int[] arr = new int[10]; arr[0] = 0; arr[1] = 1; for (int i = 2; i <= num-1; i++) { temp = a + b; a = b; b = temp; arr[i] = temp; } for (int j = 0; j <= num - 1; j++) { Console.WriteLine(arr[j]); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script>
function f1() {
var num = (document.getElementById("txtNum").value).trim();
var regx = /^[0-9]*$/;
var chkNum = regx.test(num);
if (chkNum != true) {
alert("Enter Number only..");
}
var inc = 1, temp;
for (var i = 1; i <= num - 1; i++) {