SlideShare ist ein Scribd-Unternehmen logo
1 von 26
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-1 MULTIPLICATION TABLE
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class mul
{
int no;
public void input()
{
Console.WriteLine("enter the number");
no = Convert.ToInt32(Console.ReadLine());
while (no <= 0)
{
Console.WriteLine("u entered an invaild no");
Console.WriteLine("enter a number great than 0:");
no = Convert.ToInt32(Console.ReadLine());
}
}
public void cal()
{
Console.WriteLine("multiplication table:");
for (int i = 1; i <= 10; i++)
{
Console.WriteLine(no + "*" + i + "=" + no * i);
Console.ReadLine();
}
}
class Program
{
static void Main(string[] args)
{
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
mul mp = new mul();
mp.input();
mp.cal();
Console.ReadLine();
}
}
}
}
OUTPUT:
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-2 PERFECT NUMBER
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication7
{
class Perfectnumber
{
public void perfect()
{
int n, s = 0;
Console.WriteLine("PERFECT NUMBER CHECKING");
Console.WriteLine("give INPUT number");
n = Int32.Parse(Console.ReadLine());
for (int i = 1; i < n; i++)
if (n % i == 0)
s = s + i;
if (s == n)
{
Console.WriteLine("the given number is perfect number");
}
else
{
Console.WriteLine("the number is not a perfect number");
}
}
}
class subperfect
{
static void Main(string[] args)
{
int ch;
do
{
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
Perfectnumber pf = new Perfectnumber();
pf.perfect();
Console.WriteLine("Do U want to continue");
ch = Int32.Parse(Console.ReadLine());
Console.ReadLine();
}
while (ch == 1);
}
}
}
OUTPUT:
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-3 ARMSTRONGNUMBER
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication10
{
class armstrong
{
public void armenthod()
{
int num, remainder, sum = 0;
Console.WriteLine("enter the number");
num = int.Parse(Console.ReadLine());
for (int i = num; i > 0; i = i / 10)
{
remainder = i % 10;
sum = sum + remainder * remainder * remainder;
}
if (sum == num)
{
Console.WriteLine("is args armstrong number");
}
else
{
Console.WriteLine("not a armstrong number");
}
}
}
class ppp
{
static void Main(string[] args)
{
int ch;
do
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
{
armstrong arm = new armstrong();
arm.armenthod();
Console.WriteLine("do u want to continue");
ch = Int32.Parse(Console.ReadLine());
Console.ReadLine();
} while (ch == 1);
}
}
}
OUTPUT:
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-4 PALINDROME NUMBER
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
class pali
{
int n, n1, r, s = 0;
public void input()
{
Console.WriteLine("enter the number to check number palindrome");
n = Int32.Parse(Console.ReadLine());
n1 = n;
}
public void cal()
{
while (n1 > 0)
{
r = n1 % 10;
n1 = n1 / 10;
s = r + (s * 10);
}
}
public void disp()
{
if (n == s)
{
Console.WriteLine("the number is a palindrome");
}
else
{
Console.WriteLine("the number is not palindrome");
}
}
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
class Program
{
static void Main(string[] args)
{
int ch;
do
{
pali p = new pali();
p.input();
p.cal();
p.disp();
Console.WriteLine("Do U want to continue");
ch = Int32.Parse(Console.ReadLine());
Console.ReadLine();
}
while (ch == 1);
}
}
} }
OUTPUT:
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-5 SUM OF DIGIT
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication9
{
class sumdigits
{
public void sumdigit()
{
int n,r,sum=0;
Console.WriteLine("*************************");
Console.WriteLine("sum of digits of N nubers");
Console.WriteLine("*************************");
Console.WriteLine("enter the number");
n = Int32.Parse(Console.ReadLine());
while(n!=0)
{
r=n%10;
n=n/10;
sum=sum+r;
}
Console.WriteLine("sum of digits{0}",sum);
Console.ReadLine();
}
}
class sumd
{
static void Main(string[] args)
{
int ch;
do
{
sumdigits d=new sumdigits();
d.sumdigit();
Console.WriteLine("Do U want to continuen continue(1) exit(0)");
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
ch=Int32.Parse(Console.ReadLine());
}while(ch==1);
}
}
}
OUTPUT:
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-6 PRIME NUMBER WITH A RANGE
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication12
{
class prim
{
int i, j, n1, n2, p, q;
public void input()
{
Console.WriteLine("Enter the Starting Range Number");
n1 = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the Ending Range Number");
n2 = int.Parse(Console.ReadLine());
p = n1;
q = n2;
Console.WriteLine("Prime number Range from {0} to {1} is", p, q);
}
public void calc()
{
for (i = p; i < q; i++)
{
for (j = 2; j <= (i / j); j++)
if (i % j == 0)
break;
if (j > (i / j))
{
Console.WriteLine("{0}", i);
}
}
}
}
class pr
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
{
static void Main(string[] args)
{
int ch;
do
{
Console.WriteLine("Prime Number Generation");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~");
prim p = new prim();
p.input();
p.calc();
Console.WriteLine("Do you want to perform again Press 1 or 0 to Exit");
ch = int.Parse(Console.ReadLine());
Console.ReadLine();
}
while (ch == 1);
}
}
}
OUTPUT:
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-7 FLOYDS TRIANGLE
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication14
{
class floyds
{
int i, j, k = 1, n1;
public void input()
{
Console.WriteLine("Enter the Number");
n1 = int.Parse(Console.ReadLine());
}
public void calc()
{
for (i = 1; i <= n1; i++)
{
for (j = 1; j <= i + 1; j++)
{
Console.Write(k++ + " ");
}
Console.WriteLine("n");
}
Console.ReadLine();
}
}
class flower
{
static void Main(string[] args)
{
int ch;
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
do
{
Console.WriteLine("Floyd's Triangle");
Console.WriteLine("*********************");
floyds ff = new floyds();
ff.input();
ff.calc();
Console.WriteLine("Do you want to perform again Press 1 or 0 to
Exitn");
ch = int.Parse(Console.ReadLine());
Console.ReadLine();
}
while (ch == 1);
}
}
}
OUTPUT:
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-8 ASCII VALUES
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class asc
{
string s;
public void input()
{
Console.WriteLine("Enter the sentence to find ascii code");
s = Console.ReadLine();
}
public void calc()
{
foreach (char c in s)
{
Console.WriteLine((int)c);
}
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Find Ascii Value string");
Console.WriteLine("*****************");
asc a = new asc();
a.input();
a.calc();
Console.ReadLine();
}
}
}
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
OUTPUT:
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-9 FACTORS OF A GIVEN NUMBER
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication12
{
class prim
{
int i, j, n1, n2, p, q;
public void input()
{
Console.WriteLine("Enter the Starting Range Number");
n1 = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the Ending Range Number");
n2 = int.Parse(Console.ReadLine());
p = n1;
q = n2;
Console.WriteLine("Prime number Range from {0} to {1} is", p, q);
}
public void calc()
{
for (i = p; i < q; i++)
{
for (j = 2; j <= (i / j); j++)
if (i % j == 0)
break;
if (j > (i / j))
{
Console.WriteLine("{0}", i);
}
}
}
}
class pr
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
{
static void Main(string[] args)
{
int ch;
do
{
Console.WriteLine("Prime Number Generation");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~");
prim p = new prim();
p.input();
p.calc();
Console.WriteLine("Do you want to perform again Press 1 or 0 to Exit");
ch = int.Parse(Console.ReadLine());
Console.ReadLine();
}
while (ch == 1);
}
}
}
OUTPUT:
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-10 (A)CONVERT DECIMAL TO BINARY
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication28
{
class conv
{
public void esdectobin()
{
Console.WriteLine("Converting Decimal value to binary value");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
int num, quot, n;
string rem = "";
string bin = "";
Console.WriteLine("Enter the number");
num = int.Parse(Console.ReadLine());
n = num;
while (num >= 1)
{
quot = num / 2;
rem += (num % 2).ToString();
num = quot;
}
//Reversing the Value
for (int i = rem.Length - 1; i >= 0; i--)
{
bin = bin + rem[i];
}
Console.WriteLine("nThe binary format for {0} is {1}", n, bin);
}
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
class Program
{
static void Main(string[] args)
{
int ch;
do
{
conv d = new conv();
d.esdectobin();
Console.WriteLine("Do U want to continue");
ch = Int32.Parse(Console.ReadLine());
Console.ReadLine();
}
while (ch == 1);
}
}
}
}
OUTPUT:
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-10 (B)CONVERT BINARYTO DECIMAL
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication29
{
class conv
{
public void esbintodec()
{
Console.WriteLine("Converting binary value to decimal value");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
int rem, num, bvalue, dvalue = 0, basevalue = 1;
Console.WriteLine("Enter the number");
num = int.Parse(Console.ReadLine());
bvalue = num;
while (num > 0)
{
rem = num % 10;
dvalue = dvalue + rem * basevalue;
num = num / 10;
basevalue = basevalue * 2;
}
Console.Write("nBinary number {0} equivalent decimal number is {1}",
bvalue, dvalue);
}
class Program
{
static void Main(string[] args)
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
{
int ch;
do
{
conv d = new conv();
d.esbintodec();
Console.WriteLine("Do U want to continue");
ch = Int32.Parse(Console.ReadLine());
Console.ReadLine();
}
while (ch == 1);
}
}
}
}
OUTPUT:
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-10 (C) CONVERT DECIMALTO OCTAL
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication32
{
class conv
{
public void esdectohexa()
{
Console.WriteLine("Converting Decimal value to hexa value");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
int n, decimelnum, quot, i = 1, j, temp = 0;
char[] hexnum = new char[100];
char temp1;
Console.WriteLine("Enter the number");
decimelnum = int.Parse(Console.ReadLine());
n = decimelnum;
quot = decimelnum;
while (quot != 0)
{
temp = quot % 16;
if (temp < 10)
temp = temp + 48;
else
temp = temp + 55;
temp1 = Convert.ToChar(temp);
hexnum[i++] = temp1;
quot = quot / 16;
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
}
Console.Write("nDecimal number {0} equivalent Hexadecimal number is
", n);
for (j = i - 1; j > 0; j--)
Console.Write("{0}", hexnum[j]);
}
class Program
{
static void Main(string[] args)
{
int ch;
do
{
conv d = new conv();
d.esdectohexa();
Console.WriteLine("Do U want to continue");
ch = Int32.Parse(Console.ReadLine());
Console.ReadLine();
}
while (ch == 1);
}
}
}
}
OUTPUT:
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
LABLIST:1 EX.NO-10 (D)CONVERT DECIMALTO HEXADECIMAL
SOURCE CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication32
{
class conv
{
public void esdectohexa()
{
Console.WriteLine("Converting Decimal value to hexa value");
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
int n, decimelnum, quot, i = 1, j, temp = 0;
char[] hexnum = new char[100];
char temp1;
Console.WriteLine("Enter the number");
decimelnum = int.Parse(Console.ReadLine());
n = decimelnum;
quot = decimelnum;
while (quot != 0)
{
temp = quot % 16;
if (temp < 10)
temp = temp + 48;
else
temp = temp + 55;
temp1 = Convert.ToChar(temp);
hexnum[i++] = temp1;
quot = quot / 16;
SUB NAME: .NET PROGRAMMING
Dr.M.KarthikaITDepartment
}
Console.Write("nDecimal number {0} equivalent Hexadecimal number is
", n);
for (j = i - 1; j > 0; j--)
Console.Write("{0}", hexnum[j]);
}
class Program
{
static void Main(string[] args)
{
int ch;
do
{
conv d = new conv();
d.esdectohexa();
Console.WriteLine("Do U want to continue");
ch = Int32.Parse(Console.ReadLine());
Console.ReadLine();
}
while (ch == 1);
}
}
}
}
OUTPUT:

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (18)

High performance web programming with C++14
High performance web programming with C++14High performance web programming with C++14
High performance web programming with C++14
 
39927902 c-labmanual
39927902 c-labmanual39927902 c-labmanual
39927902 c-labmanual
 
Isc computer project final upload last
Isc computer project final upload lastIsc computer project final upload last
Isc computer project final upload last
 
Writing beautiful code with Java 8
Writing beautiful code with Java 8Writing beautiful code with Java 8
Writing beautiful code with Java 8
 
Java file
Java fileJava file
Java file
 
Tools and Techniques for Understanding Threading Behavior in Android*
Tools and Techniques for Understanding Threading Behavior in Android*Tools and Techniques for Understanding Threading Behavior in Android*
Tools and Techniques for Understanding Threading Behavior in Android*
 
7
77
7
 
1z0 851 exam-java standard edition 6 programmer certified professional
1z0 851 exam-java standard edition 6 programmer certified professional1z0 851 exam-java standard edition 6 programmer certified professional
1z0 851 exam-java standard edition 6 programmer certified professional
 
Presentation1 computer shaan
Presentation1 computer shaanPresentation1 computer shaan
Presentation1 computer shaan
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' Mistakes
 
Anjalisoorej imca133 assignment
Anjalisoorej imca133 assignmentAnjalisoorej imca133 assignment
Anjalisoorej imca133 assignment
 
Mutation @ Spotify
Mutation @ Spotify Mutation @ Spotify
Mutation @ Spotify
 
Update on C++ Core Guidelines Lifetime Analysis. Gábor Horváth. CoreHard Spri...
Update on C++ Core Guidelines Lifetime Analysis. Gábor Horváth. CoreHard Spri...Update on C++ Core Guidelines Lifetime Analysis. Gábor Horváth. CoreHard Spri...
Update on C++ Core Guidelines Lifetime Analysis. Gábor Horváth. CoreHard Spri...
 
Ds program-print
Ds program-printDs program-print
Ds program-print
 
Digital system design practical file
Digital system design practical fileDigital system design practical file
Digital system design practical file
 
Lab4
Lab4Lab4
Lab4
 
Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17Alexey Tsoy Meta Programming in C++ 16.11.17
Alexey Tsoy Meta Programming in C++ 16.11.17
 
Qno 1 (c)
Qno 1 (c)Qno 1 (c)
Qno 1 (c)
 

Ähnlich wie .net progrmming part1

Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4
Abed Bukhari
 
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
Phil Calçado
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in c
gkgaur1987
 
81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs
Abhishek Jena
 
Assignment no39
Assignment no39Assignment no39
Assignment no39
Jay Patel
 
DATA STRUCTURE USING C & C++
DATA STRUCTURE USING C & C++DATA STRUCTURE USING C & C++
DATA STRUCTURE USING C & C++
mustkeem khan
 

Ähnlich wie .net progrmming part1 (20)

.net progrmming part2
.net progrmming part2.net progrmming part2
.net progrmming part2
 
Dotnet 18
Dotnet 18Dotnet 18
Dotnet 18
 
ASP.NET
ASP.NETASP.NET
ASP.NET
 
Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4
 
Java file
Java fileJava file
Java file
 
39927902 c-labmanual
39927902 c-labmanual39927902 c-labmanual
39927902 c-labmanual
 
C# Lab Programs.pdf
C# Lab Programs.pdfC# Lab Programs.pdf
C# Lab Programs.pdf
 
C# Lab Programs.pdf
C# Lab Programs.pdfC# Lab Programs.pdf
C# Lab Programs.pdf
 
delegates
delegatesdelegates
delegates
 
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...
 
Mouse programming in c
Mouse programming in cMouse programming in c
Mouse programming in c
 
Apache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheelApache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheel
 
81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs
 
Hems
HemsHems
Hems
 
Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
 
TechTalk - Dotnet
TechTalk - DotnetTechTalk - Dotnet
TechTalk - Dotnet
 
Assignment no39
Assignment no39Assignment no39
Assignment no39
 
Java programs
Java programsJava programs
Java programs
 
DATA STRUCTURE USING C & C++
DATA STRUCTURE USING C & C++DATA STRUCTURE USING C & C++
DATA STRUCTURE USING C & C++
 
DSU C&C++ Practical File Diploma
DSU C&C++ Practical File DiplomaDSU C&C++ Practical File Diploma
DSU C&C++ Practical File Diploma
 

Mehr von Dr.M.Karthika parthasarathy

Mehr von Dr.M.Karthika parthasarathy (20)

IoT Enabled Wireless Technology Based Monitoring and Speed Control of Motor U...
IoT Enabled Wireless Technology Based Monitoring and Speed Control of Motor U...IoT Enabled Wireless Technology Based Monitoring and Speed Control of Motor U...
IoT Enabled Wireless Technology Based Monitoring and Speed Control of Motor U...
 
Linux Lab Manual.doc
Linux Lab Manual.docLinux Lab Manual.doc
Linux Lab Manual.doc
 
Unit 2 IoT.pdf
Unit 2 IoT.pdfUnit 2 IoT.pdf
Unit 2 IoT.pdf
 
Unit 3 IOT.docx
Unit 3 IOT.docxUnit 3 IOT.docx
Unit 3 IOT.docx
 
Unit 1 Introduction to Artificial Intelligence.pptx
Unit 1 Introduction to Artificial Intelligence.pptxUnit 1 Introduction to Artificial Intelligence.pptx
Unit 1 Introduction to Artificial Intelligence.pptx
 
Unit I What is Artificial Intelligence.docx
Unit I What is Artificial Intelligence.docxUnit I What is Artificial Intelligence.docx
Unit I What is Artificial Intelligence.docx
 
Introduction to IoT - Unit II.pptx
Introduction to IoT - Unit II.pptxIntroduction to IoT - Unit II.pptx
Introduction to IoT - Unit II.pptx
 
IoT Unit 2.pdf
IoT Unit 2.pdfIoT Unit 2.pdf
IoT Unit 2.pdf
 
Chapter 3 heuristic search techniques
Chapter 3 heuristic search techniquesChapter 3 heuristic search techniques
Chapter 3 heuristic search techniques
 
Ai mcq chapter 2
Ai mcq chapter 2Ai mcq chapter 2
Ai mcq chapter 2
 
Introduction to IoT unit II
Introduction to IoT  unit IIIntroduction to IoT  unit II
Introduction to IoT unit II
 
Introduction to IoT - Unit I
Introduction to IoT - Unit IIntroduction to IoT - Unit I
Introduction to IoT - Unit I
 
Internet of things Unit 1 one word
Internet of things Unit 1 one wordInternet of things Unit 1 one word
Internet of things Unit 1 one word
 
Unit 1 q&amp;a
Unit  1 q&amp;aUnit  1 q&amp;a
Unit 1 q&amp;a
 
Overview of Deadlock unit 3 part 1
Overview of Deadlock unit 3 part 1Overview of Deadlock unit 3 part 1
Overview of Deadlock unit 3 part 1
 
Examples in OS synchronization for UG
Examples in OS synchronization for UG Examples in OS synchronization for UG
Examples in OS synchronization for UG
 
Process Synchronization - Monitors
Process Synchronization - MonitorsProcess Synchronization - Monitors
Process Synchronization - Monitors
 
.net progrmming part4
.net progrmming part4.net progrmming part4
.net progrmming part4
 
.net progrmming part3
.net progrmming part3.net progrmming part3
.net progrmming part3
 
What is a shell script
What is a shell scriptWhat is a shell script
What is a shell script
 

Kürzlich hochgeladen

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 

Kürzlich hochgeladen (20)

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 

.net progrmming part1

  • 1. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-1 MULTIPLICATION TABLE SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class mul { int no; public void input() { Console.WriteLine("enter the number"); no = Convert.ToInt32(Console.ReadLine()); while (no <= 0) { Console.WriteLine("u entered an invaild no"); Console.WriteLine("enter a number great than 0:"); no = Convert.ToInt32(Console.ReadLine()); } } public void cal() { Console.WriteLine("multiplication table:"); for (int i = 1; i <= 10; i++) { Console.WriteLine(no + "*" + i + "=" + no * i); Console.ReadLine(); } } class Program { static void Main(string[] args) {
  • 2. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment mul mp = new mul(); mp.input(); mp.cal(); Console.ReadLine(); } } } } OUTPUT:
  • 3. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-2 PERFECT NUMBER SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication7 { class Perfectnumber { public void perfect() { int n, s = 0; Console.WriteLine("PERFECT NUMBER CHECKING"); Console.WriteLine("give INPUT number"); n = Int32.Parse(Console.ReadLine()); for (int i = 1; i < n; i++) if (n % i == 0) s = s + i; if (s == n) { Console.WriteLine("the given number is perfect number"); } else { Console.WriteLine("the number is not a perfect number"); } } } class subperfect { static void Main(string[] args) { int ch; do {
  • 4. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment Perfectnumber pf = new Perfectnumber(); pf.perfect(); Console.WriteLine("Do U want to continue"); ch = Int32.Parse(Console.ReadLine()); Console.ReadLine(); } while (ch == 1); } } } OUTPUT:
  • 5. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-3 ARMSTRONGNUMBER SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication10 { class armstrong { public void armenthod() { int num, remainder, sum = 0; Console.WriteLine("enter the number"); num = int.Parse(Console.ReadLine()); for (int i = num; i > 0; i = i / 10) { remainder = i % 10; sum = sum + remainder * remainder * remainder; } if (sum == num) { Console.WriteLine("is args armstrong number"); } else { Console.WriteLine("not a armstrong number"); } } } class ppp { static void Main(string[] args) { int ch; do
  • 6. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment { armstrong arm = new armstrong(); arm.armenthod(); Console.WriteLine("do u want to continue"); ch = Int32.Parse(Console.ReadLine()); Console.ReadLine(); } while (ch == 1); } } } OUTPUT:
  • 7. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-4 PALINDROME NUMBER SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication5 { class pali { int n, n1, r, s = 0; public void input() { Console.WriteLine("enter the number to check number palindrome"); n = Int32.Parse(Console.ReadLine()); n1 = n; } public void cal() { while (n1 > 0) { r = n1 % 10; n1 = n1 / 10; s = r + (s * 10); } } public void disp() { if (n == s) { Console.WriteLine("the number is a palindrome"); } else { Console.WriteLine("the number is not palindrome"); } }
  • 8. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment class Program { static void Main(string[] args) { int ch; do { pali p = new pali(); p.input(); p.cal(); p.disp(); Console.WriteLine("Do U want to continue"); ch = Int32.Parse(Console.ReadLine()); Console.ReadLine(); } while (ch == 1); } } } } OUTPUT:
  • 9. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-5 SUM OF DIGIT SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication9 { class sumdigits { public void sumdigit() { int n,r,sum=0; Console.WriteLine("*************************"); Console.WriteLine("sum of digits of N nubers"); Console.WriteLine("*************************"); Console.WriteLine("enter the number"); n = Int32.Parse(Console.ReadLine()); while(n!=0) { r=n%10; n=n/10; sum=sum+r; } Console.WriteLine("sum of digits{0}",sum); Console.ReadLine(); } } class sumd { static void Main(string[] args) { int ch; do { sumdigits d=new sumdigits(); d.sumdigit(); Console.WriteLine("Do U want to continuen continue(1) exit(0)");
  • 10. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment ch=Int32.Parse(Console.ReadLine()); }while(ch==1); } } } OUTPUT:
  • 11. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-6 PRIME NUMBER WITH A RANGE SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication12 { class prim { int i, j, n1, n2, p, q; public void input() { Console.WriteLine("Enter the Starting Range Number"); n1 = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the Ending Range Number"); n2 = int.Parse(Console.ReadLine()); p = n1; q = n2; Console.WriteLine("Prime number Range from {0} to {1} is", p, q); } public void calc() { for (i = p; i < q; i++) { for (j = 2; j <= (i / j); j++) if (i % j == 0) break; if (j > (i / j)) { Console.WriteLine("{0}", i); } } } } class pr
  • 12. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment { static void Main(string[] args) { int ch; do { Console.WriteLine("Prime Number Generation"); Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~"); prim p = new prim(); p.input(); p.calc(); Console.WriteLine("Do you want to perform again Press 1 or 0 to Exit"); ch = int.Parse(Console.ReadLine()); Console.ReadLine(); } while (ch == 1); } } } OUTPUT:
  • 13. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-7 FLOYDS TRIANGLE SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication14 { class floyds { int i, j, k = 1, n1; public void input() { Console.WriteLine("Enter the Number"); n1 = int.Parse(Console.ReadLine()); } public void calc() { for (i = 1; i <= n1; i++) { for (j = 1; j <= i + 1; j++) { Console.Write(k++ + " "); } Console.WriteLine("n"); } Console.ReadLine(); } } class flower { static void Main(string[] args) { int ch;
  • 14. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment do { Console.WriteLine("Floyd's Triangle"); Console.WriteLine("*********************"); floyds ff = new floyds(); ff.input(); ff.calc(); Console.WriteLine("Do you want to perform again Press 1 or 0 to Exitn"); ch = int.Parse(Console.ReadLine()); Console.ReadLine(); } while (ch == 1); } } } OUTPUT:
  • 15. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-8 ASCII VALUES SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication3 { class asc { string s; public void input() { Console.WriteLine("Enter the sentence to find ascii code"); s = Console.ReadLine(); } public void calc() { foreach (char c in s) { Console.WriteLine((int)c); } } } class Program { static void Main(string[] args) { Console.WriteLine("Find Ascii Value string"); Console.WriteLine("*****************"); asc a = new asc(); a.input(); a.calc(); Console.ReadLine(); } } }
  • 16. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment OUTPUT:
  • 17. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-9 FACTORS OF A GIVEN NUMBER SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication12 { class prim { int i, j, n1, n2, p, q; public void input() { Console.WriteLine("Enter the Starting Range Number"); n1 = int.Parse(Console.ReadLine()); Console.WriteLine("Enter the Ending Range Number"); n2 = int.Parse(Console.ReadLine()); p = n1; q = n2; Console.WriteLine("Prime number Range from {0} to {1} is", p, q); } public void calc() { for (i = p; i < q; i++) { for (j = 2; j <= (i / j); j++) if (i % j == 0) break; if (j > (i / j)) { Console.WriteLine("{0}", i); } } } } class pr
  • 18. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment { static void Main(string[] args) { int ch; do { Console.WriteLine("Prime Number Generation"); Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~"); prim p = new prim(); p.input(); p.calc(); Console.WriteLine("Do you want to perform again Press 1 or 0 to Exit"); ch = int.Parse(Console.ReadLine()); Console.ReadLine(); } while (ch == 1); } } } OUTPUT:
  • 19. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-10 (A)CONVERT DECIMAL TO BINARY SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication28 { class conv { public void esdectobin() { Console.WriteLine("Converting Decimal value to binary value"); Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); int num, quot, n; string rem = ""; string bin = ""; Console.WriteLine("Enter the number"); num = int.Parse(Console.ReadLine()); n = num; while (num >= 1) { quot = num / 2; rem += (num % 2).ToString(); num = quot; } //Reversing the Value for (int i = rem.Length - 1; i >= 0; i--) { bin = bin + rem[i]; } Console.WriteLine("nThe binary format for {0} is {1}", n, bin); }
  • 20. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment class Program { static void Main(string[] args) { int ch; do { conv d = new conv(); d.esdectobin(); Console.WriteLine("Do U want to continue"); ch = Int32.Parse(Console.ReadLine()); Console.ReadLine(); } while (ch == 1); } } } } OUTPUT:
  • 21. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-10 (B)CONVERT BINARYTO DECIMAL SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication29 { class conv { public void esbintodec() { Console.WriteLine("Converting binary value to decimal value"); Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); int rem, num, bvalue, dvalue = 0, basevalue = 1; Console.WriteLine("Enter the number"); num = int.Parse(Console.ReadLine()); bvalue = num; while (num > 0) { rem = num % 10; dvalue = dvalue + rem * basevalue; num = num / 10; basevalue = basevalue * 2; } Console.Write("nBinary number {0} equivalent decimal number is {1}", bvalue, dvalue); } class Program { static void Main(string[] args)
  • 22. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment { int ch; do { conv d = new conv(); d.esbintodec(); Console.WriteLine("Do U want to continue"); ch = Int32.Parse(Console.ReadLine()); Console.ReadLine(); } while (ch == 1); } } } } OUTPUT:
  • 23. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-10 (C) CONVERT DECIMALTO OCTAL SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication32 { class conv { public void esdectohexa() { Console.WriteLine("Converting Decimal value to hexa value"); Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); int n, decimelnum, quot, i = 1, j, temp = 0; char[] hexnum = new char[100]; char temp1; Console.WriteLine("Enter the number"); decimelnum = int.Parse(Console.ReadLine()); n = decimelnum; quot = decimelnum; while (quot != 0) { temp = quot % 16; if (temp < 10) temp = temp + 48; else temp = temp + 55; temp1 = Convert.ToChar(temp); hexnum[i++] = temp1; quot = quot / 16;
  • 24. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment } Console.Write("nDecimal number {0} equivalent Hexadecimal number is ", n); for (j = i - 1; j > 0; j--) Console.Write("{0}", hexnum[j]); } class Program { static void Main(string[] args) { int ch; do { conv d = new conv(); d.esdectohexa(); Console.WriteLine("Do U want to continue"); ch = Int32.Parse(Console.ReadLine()); Console.ReadLine(); } while (ch == 1); } } } } OUTPUT:
  • 25. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment LABLIST:1 EX.NO-10 (D)CONVERT DECIMALTO HEXADECIMAL SOURCE CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication32 { class conv { public void esdectohexa() { Console.WriteLine("Converting Decimal value to hexa value"); Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); int n, decimelnum, quot, i = 1, j, temp = 0; char[] hexnum = new char[100]; char temp1; Console.WriteLine("Enter the number"); decimelnum = int.Parse(Console.ReadLine()); n = decimelnum; quot = decimelnum; while (quot != 0) { temp = quot % 16; if (temp < 10) temp = temp + 48; else temp = temp + 55; temp1 = Convert.ToChar(temp); hexnum[i++] = temp1; quot = quot / 16;
  • 26. SUB NAME: .NET PROGRAMMING Dr.M.KarthikaITDepartment } Console.Write("nDecimal number {0} equivalent Hexadecimal number is ", n); for (j = i - 1; j > 0; j--) Console.Write("{0}", hexnum[j]); } class Program { static void Main(string[] args) { int ch; do { conv d = new conv(); d.esdectohexa(); Console.WriteLine("Do U want to continue"); ch = Int32.Parse(Console.ReadLine()); Console.ReadLine(); } while (ch == 1); } } } } OUTPUT: