Practical 1 Awp
Practical 1 Awp
Methods :
1. Console.WriteLine() : This method is used to print data along with printing the
new line.
2. Console.ReadLine() : This method is used to read the next line of
characters from the standard input stream.
3. Convert.ToInt32() : Converts the specified string representation of a number
to an equivalent 32-bit signed integer.
4. Console.ReadKey() : Obtains the next character or function key pressed by
the user. The pressed key is displayed in the console window.
Code :
using System;
namespace practical_no1a
{
class Program
{
static void Main(string[] args)
{
int num1, num2, num3, num4, prod;
Console.WriteLine("enter value for num1 :");
num1 = Convert.ToInt32(Console.ReadLine());
num3 = Convert.ToInt32(Console.ReadLine());
Console.ReadKey();
}
}
}
Output:
PRACTICAL 1 b] Create an application to demonstrate string operations.
Methods :
Code :
using System;
namespace practical_no1b
{
class Program
{
static void Main(string[] args)
{
String s1 = " good morning ", ans;
String s2 = "STUDENTS";
String s3 = " ";
ans = s1.ToUpper();
Console.WriteLine(ans);
ans = s1.Trim();
Console.WriteLine(ans);
ans = s1.Insert(2, "p");
Console.WriteLine(ans);
ans = s2.ToLower();
Console.WriteLine(ans);
s3 = String.Copy(s1);
Console.WriteLine(s3);
Console.Read();
}
}
}
Output:
PRACTICAL 1 c] Create an application that receives the (Student Id, Student
Name, Course Name, Date of Birth) information from a set of students. The
application should also display the information of all the students once the data
entered.
Methods :
Code :
using System;
namespace practial1c
{
struct student
{
int sid;
String sname;
String cname;
DateTime dob;
class Program
{
static void Main(string[] args)
{
student[] allstudents = new student[3];
Console.WriteLine("*****************");
Console.WriteLine("student information");
Console.WriteLine("*****************");
}
}
}
Output: