Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

All set1

788 views

Published on

  • Be the first to comment

  • Be the first to like this

All set1

  1. 1. Roll No. 20956 1.Hellousing System;namespace program{ class hello { static void Main(string[] args) { Console.WriteLine("hello"); Console.ReadLine(); } }}
  2. 2. Roll No. 20956 2.Primeusing System;namespace series{ class prime { public static void Main(string[] args) { int x, i, count = 0; Console.WriteLine("Enter number"); x = Convert.ToInt32(Console.ReadLine()); for (i = 2; i <= x; i++) { if (x % i == 0) count = count + 1; } if (count == 2) Console.Write("not prime number"); else Console.Write("Prime number"); Console.ReadLine(); } }}
  3. 3. Roll No. 20956 3.Armstrongusing System;namespace series{ class armstrong1 { public static void Main(string[] args) { int x, cs = 0, rem, temp; Console.WriteLine("Enter number ->"); x = Convert.ToInt32(Console.ReadLine()); temp = x; while (x > 0) { rem = x % 10; cs = cs + (rem * rem * rem); x = x / 10; } if (temp == cs) Console.WriteLine("armstrong"); else Console.WriteLine(" not armstrong"); Console.Read(); } }}
  4. 4. Roll No. 20956 4.a.using System;namespace series{ class tri { public static void Main(string[] args) { Console.WriteLine("Enter No"); int n = Convert.ToInt32(Console.ReadLine()); for (int y = 0; y <= n; y++) { for (int x = 1; x <= y; x++) { Console.Write(x); } Console.WriteLine(); } Console.ReadLine(); } }}
  5. 5. Roll No. 20956 4.busing System;namespace PascalTriangle{ class PascalTriangle { static void Main(string[] args) { Console.WriteLine("Pascal Triangle Program"); Console.Write("Enter the number of rows: "); int n = Convert.ToInt32(Console.ReadLine()); for (int y = 1; y < n; y++) { int c = 1; for (int q = 1; q < n - y; q++) { Console.Write(" "); } for (int x = 1; x <= y; x++) { Console.Write(" {0:D} ", y); } Console.WriteLine(); Console.WriteLine(); } Console.ReadLine(); } }}
  6. 6. Roll No. 20956 5.Seriesusing System;namespace series{ class series { static void Main(string[] args) { for (int i = 0; i <= 100; i++) { if (i % 5 == 0) continue; else Console.WriteLine(i); } Console.Read(); } }}
  7. 7. Roll No. 20956 6.Interestusing System;namespace series{ class interest { public static void Main(string[] args) { Console.WriteLine("Enter the value of p"); int p = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter the value of n"); int n = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Enter the value of r"); int r = Convert.ToInt32(Console.ReadLine()); double s = (p * n * r) / 100; Console.WriteLine("Simple Interest ->t{0}", s); Console.ReadLine(); } }}
  8. 8. Roll No. 20956 7.a.Odd Seriesusing System;namespace series{ class _7ab { public static void Main(string[] args) { int e = 0, f = 0; Console.WriteLine("enter no."); int a = Convert.ToInt32(Console.ReadLine()); for (int i = 1; i <= a; i++) { int c = i % 2; if (c == 0) { continue; } else { f = f + (i * i); } } Console.WriteLine(" total -> {0}", f); Console.ReadLine(); } }}
  9. 9. Roll No. 20956
  10. 10. Roll No. 20956 7.b Even Seriesusing System;namespace series{ class _7ab { public static void Main(string[] args) { int e = 0, f = 0; Console.WriteLine("enter no."); int a = Convert.ToInt32(Console.ReadLine()); for (int i = 1; i <= a - 1; i++) { int c = i % 2; if (c == 0) { e = e + (i * i * i * i); } else { //f = f + (i * i); continue; } } Console.WriteLine("total -> {0}", e); Console.ReadLine(); } }}
  11. 11. Roll No. 20956
  12. 12. Roll No. 20956 8.a.Pascal Triangleusing System;namespace PascalTriangle{ class PascalTriangle { static void Main(string[] args) { System.Console.WriteLine("Pascal Triangle Program"); System.Console.Write("Enter the number of rows: "); int n = Convert.ToInt32(Console.ReadLine()); for (int y = 0; y < n; y++) { int c = 1; for (int q = 0; q < n - y; q++) { Console.Write(" "); } for (int x = 0; x <= y; x++) { Console.Write(" {0:D} ", c); c = c * (y - x) / (x + 1); } Console.WriteLine(); Console.WriteLine(); } Console.Read(); } }}
  13. 13. Roll No. 20956

×