• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
All set1
 

All set1

on

  • 612 views

 

Statistics

Views

Total Views
612
Views on SlideShare
612
Embed Views
0

Actions

Likes
0
Downloads
28
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    All set1 All set1 Document Transcript

    • Roll No. 20956 1.Hellousing System;namespace program{ class hello { static void Main(string[] args) { Console.WriteLine("hello"); Console.ReadLine(); } }}
    • 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(); } }}
    • 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(); } }}
    • 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(); } }}
    • 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(); } }}
    • 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(); } }}
    • 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(); } }}
    • 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(); } }}
    • Roll No. 20956
    • 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(); } }}
    • Roll No. 20956
    • 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(); } }}
    • Roll No. 20956