0% found this document useful (0 votes)
23 views3 pages

Code

Uploaded by

Joker 2610
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views3 pages

Code

Uploaded by

Joker 2610
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 3

using System;

class HelloWorld {

static void Main() {

int n, no, sum=0, i=10;

/* for(;i>0;)

Console.WriteLine("HelloWorld {0}",i);

i=i-5;

*/

Console.WriteLine("Enter how many numbers : ");

n=Convert.ToInt32(Console.ReadLine());

/*for(i=0;i<n;i++)

no=Convert.ToInt32(Console.ReadLine());

sum=sum+no;

}*/

i=1;

while(i<=n)

no=Convert.ToInt32(Console.ReadLine());

sum=sum+no;

i++;

Console.WriteLine("Sum is {0}",sum);
}

using System;

class Student

int rno; //data member

string name;

public void getdata() //member function

Console.WriteLine("Enter Rollno and Name ");

rno=Convert.ToInt32(Console.ReadLine());

name=Console.ReadLine();

public void putdata()

Console.WriteLine("Rollno : {0} and Name : {1}",rno,name);


}

class HelloWorld {

static void Main() {

Student s1=new Student(); //object creation

s1.getdata();

s1.putdata();

Student s2=new Student(); //object creation

s2.getdata();

s2.putdata();

Student s3=new Student(); //object creation

s3.getdata();

s3.putdata();

You might also like