ASP 29-34

21
PRACTICAL NO:30. AIM:WAP TO IMPLEMENT 2 DIMENSIONAL ARRAY. using System; namespace array_multidim { class Program { static void Main(string[] args) { int[,] arr = new int[4, 3]; for (int x = 0; x < 4; x++) { Console.WriteLine("Enter row element : {0}", x + 1); for (int y = 0; y < 3; y++) { arr[x, y] = Int32.Parse(Console.ReadLine()); } } for (int x = 0; x < 4; x++) { Console.WriteLine("Values of row : {0}", x + 1); for (int y = 0; y < 3; y++) { Console.Write(arr[x, y] + "\t"); } Console.WriteLine(); } Console.ReadLine(); }

Transcript of ASP 29-34

Page 1: ASP 29-34

PRACTICAL NO:30.

AIM:WAP TO IMPLEMENT 2 DIMENSIONAL ARRAY.using System;

namespace array_multidim{ class Program { static void Main(string[] args) { int[,] arr = new int[4, 3];

for (int x = 0; x < 4; x++) { Console.WriteLine("Enter row element : {0}", x + 1); for (int y = 0; y < 3; y++) { arr[x, y] = Int32.Parse(Console.ReadLine()); } }

for (int x = 0; x < 4; x++) { Console.WriteLine("Values of row : {0}", x + 1);

for (int y = 0; y < 3; y++) {

Console.Write(arr[x, y] + "\t"); } Console.WriteLine(); }

Console.ReadLine(); } }}

Page 2: ASP 29-34

OUTPUT:

NAME: Sameer.jadhav

ROLL NO:46.

CLASS:TYIT.

PRACTICAL NO:31.

AIM:WAP TO IMPLEMENT JAGGED ARRAY.

Page 3: ASP 29-34

using System;using System.Collections.Generic;using System.Linq;using System.Text;

namespace _2_DARRAY{ class Program { static void Main(string[] args) { int[][] JA = new int[3][] { new int[]{0,1,2,3},new int[]{12,13,14},new int[]{40,41,42,43,44} }; Console.WriteLine(JA[2][2]); Console.ReadKey();

} }}

Page 4: ASP 29-34

OUTPUT:

NAME: Sameer.jadhav

ROLL NO:46.

CLASS:TYIT.

Page 5: ASP 29-34

PRACTICAL NO:32.

AIM: WRITE A CONSOLE APPLICATION THAT OBTAINS FOUR INT VALUES FROM THE USER AND DISPLAYS THE PRODUCT. HINT: YOU MAY RECALL THAT THE CONVERT.TODOUBLE() COMMAND WAS USED TO CONVERT THE INPUT FROM THE CONSOLE TO A DOUBLE; THE EQUIVALENT COMMAND TO CONVERT FROM A STRING TO AN INT IS CONVERT.TOINT32().using System;

namespace Practical1{ class Practical { static void Main() { int no1, no2, no3,no4,product; Console.WriteLine("Enter Four No : "); no1 = Convert.ToInt32(Console.ReadLine()); no2 = Convert.ToInt32(Console.ReadLine()); no3 = Convert.ToInt32(Console.ReadLine()); no4 = Convert.ToInt32(Console.ReadLine()); product = no1 * no2 * no3 * no4; Console.WriteLine("product of Given No = " + product); Console.ReadLine();

} }}

Page 6: ASP 29-34

OUTPUT:

NAME: Sameer.jadhav

ROLL NO:46.

CLASS:TYIT.

Page 7: ASP 29-34

PRACTICAL NO:33.

AIM: IF YOU HAVE TWO INTEGERS STORED IN VARIABLES VAR1 AND VAR2, WHAT BOOLEAN TEST CAN YOU PERFORM TO SEE IF ONE OR THE OTHER (BUT NOT BOTH) IS GREATER THAN 10?using System;using System.Collections.Generic;using System.Linq;using System.Text;

namespace P2{ class Program { static void Main(string[] args) { int var1, var2; Console.WriteLine("enter two variables:"); var1 = Convert.ToInt32(Console.ReadLine()); var2 = Convert.ToInt32(Console.ReadLine()); if (var1 > 10 && var2>10) { Console.WriteLine("INVALID INPUT"); } else if (var1 > 10 && var2 < 10) { Console.WriteLine("INVALID INPUT"); } else if (var1 < 10 && var2 > 10) { Console.WriteLine("INVALID INPUT"); } else { Console.WriteLine("VALID INPUT"); } Console.ReadKey();

} }

Page 8: ASP 29-34

}

OUTPUT:

NAME: Sameer.jadhav

ROLL NO:46.

CLASS:TYIT.

PRACTICAL NO:34.

Page 9: ASP 29-34

(34.A):

AIM:WAP TO IMPLEMENT INLINE CSS.

SOURCE CODE:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="inline.aspx.cs" Inherits="inline" %>

<!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 runat="server"> <title></title></head><body><p style="font-size:30px;color:Green;">INLINE CSS</p> <form id="form1" runat="server"> <div> </div> </form> </body></html>

STYLESHEET CODE:

.button{ font-family:Times New Roman; font-size:28px; font-weight:bold;}.textbox{ font-family:Times New Roman; font-size:28px; border:2px solid goldenrod}.common{ background-color:white; color:orange;

Page 10: ASP 29-34

font-size:30px; font-weight:bold;}

OUTPUT:

NAME: Sameer.jadhav

ROLL NO:46.

CLASS:TYIT.

(34.B):

Page 11: ASP 29-34

AIM:WAP TO IMPLEMENT EXTERNAL CSS.

SOURCE CODE:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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 runat="server"> <title></title> <style type="text/css"> .style1 { width: 100%; } .style2 { } .style3 { } .style4 { width: 56px; } </style></head><link rel="Stylesheet" type="text/css" href="ExternalCss.css">

<body> <form id="form1" runat="server"> &nbsp;<table class="style1"> <tr> <td class="style3" colspan="2"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:Label ID="Label1" runat="server" Text="WELCOME TO EXTERNAL CSS" CssClass="common"></asp:Label> &nbsp;&nbsp;

Page 12: ASP 29-34

</td> </tr> <tr> <td class="style4"> <asp:Label ID="Label2" runat="server" Text="USERNAME" CssClass="common"></asp:Label> </td> <td> <asp:TextBox ID="TextBox1" runat="server" CssClass="textbox"></asp:TextBox> </td> </tr> <tr> <td class="style4"> <asp:Button ID="Button1" runat="server" Text="LOGIN" CssClass="button" /> </td> <td> &nbsp;</td> </tr> <tr> <td class="style2" colspan="2"> &nbsp;</td> </tr> </table> </form></body></html>

STYLESHEET CODE:

.button{ font-family:Times New Roman; font-size:28px; font-weight:bold;}.textbox{ font-family:Times New Roman; font-size:28px; border:2px solid goldenrod}.common{ background-color:white; color:orange;

Page 13: ASP 29-34

font-size:30px; font-weight:bold;}

OUTPUT:

NAME: Sameer.jadhav

ROLL NO:46.

CLASS:TYIT.

PRACTICAL NO:26.

AIM:LOGIN FORM WITH BACKGROUND IMAGE.

Page 14: ASP 29-34

NAME: Sameer.jadhav

ROLL NO:46.

CLASS:TYIT.

PRACTICAL NO -30

AIM : WAP TO IMPLEMENT DELEGATE METHOD.using System;

namespace ConsoleApplication2{publicdelegatevoiddele();classProgram {publicstaticvoid Example()

Page 15: ASP 29-34

{Console.WriteLine("called by delegate.");}publicstaticvoid Main(){dele d1 = newdele(Example); d1();Console.ReadKey();

} }}Output:

NAME: Sameer.jadhav

Roll no 46

TYIT

Practical-33

AIM: WAP TO IMPLEMENT EMBEDDED STYLE SHEET(INTERNAL STYLE SHEET).<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Embeddedstylesheet.aspx.cs"Inherits="Embeddedstylesheet"%>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Page 16: ASP 29-34

<html><head><title> Learning Embedded Stylesheet</title><Styletype="text/css">p{color:Green}importantstuff{fontsize:20;}#lOOkhere {fontsize:28px; text_align;center;color:Green}</style><body><p> I AM LEARNING HTML!</p><Pclass="IMPORTANT STUFF">I AM LEARNINMG HTML</P><Pclass="IMPOTANT STUFF"> I AM LERNING HTML</P><formid="form1"runat="server"></form></body></head></html>output:

Name:Sameer.jadhav

ROLL NO-46

TYIT

PRACTICAL NO:25.

AIM:WAP TO IMPLEMENT LIST BOX CONTROL.

using System;

Page 17: ASP 29-34

using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){

}protected void B1_Click(object sender, EventArgs e){string uname, qual, loc = "";uname = TB1.Text;qual = LBqual.Text;for (int i = 0; i < LBloc.Items.Count; i++){if (LBloc.Items[i].Selected == true){loc += LBloc.Items[i].Text;}Label1.Text = String.Format("USERNAME:{0}<br> QUALIFICATION:{1}<br>RELOCATE:{2}", uname, qual, loc);

}}}

OUTPUT:

Page 18: ASP 29-34

Sameer.jadhav ROLL NO-46

TYIT

ALI

A LI