using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace number
{
class Program
{
static int highest(int[] a, int size)
{
int s = a[0];
int h = 0;
for (int i = 0; i < 3; i++)
{
if (s > a[i])
{
h = 0;
}
else if (s < a[i])
{
h = i;
}
}
return h;
}
static int lowest(int[] a, int size)
{
int s = a[0];
int l = 0;
for (int i = 0; i < 3; i++)
{
if (s > a[i])
{
l = i;
}
else if (s < a[i])
{
l = 0;
}
}
return l;
}
static void Main(string[] args)
{
Console.WriteLine("Enter the size");
String size = Console.ReadLine();
int N = Convert.ToInt16(size);
String[] Name = new string[N];
String[] Enrollment = new string[N];
int[] marks = new int[N];
Console.WriteLine("Enter Data For students ");
for (int i = 0; i < 3; i++)
{
Console.WriteLine("Enter Name for Student {0} ", i);
Name[i] = Console.ReadLine();
Console.WriteLine("Enter Enrollment for Student {0} ", i);
Enrollment[i] = Console.ReadLine();
Console.WriteLine("Enter Marks for Student {0} ", i);
marks[i] = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine("\n\nName\t\tEnrollment\tMarks");
for (int i = 0; i < 3; i++)
{
Console.Write("{0}\t\t", Name[i]);
Console.Write("{0}\t\t", Enrollment[i]);
Console.WriteLine("{0}\t", marks[i]);
}
//Console.WriteLine("\n\nStudent With highest and Lowest Marks");
int h= highest(marks, N);
int l= lowest(marks, N);
Console.WriteLine("Record of student With highest marks \n\n");
Console.WriteLine("{0}\t\t{1}\t\t{2} ", Name[h], Enrollment[h], marks[h]);
Console.WriteLine("Record of student With Lowest marks\n\n");
Console.WriteLine("{0}\t\t{1}\t\t{2} ", Name[l], Enrollment[l], marks[l]);
Console.ReadLine();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace number
{
class Program
{
static int highest(int[] a, int size)
{
int s = a[0];
int h = 0;
for (int i = 0; i < 3; i++)
{
if (s > a[i])
{
h = 0;
}
else if (s < a[i])
{
h = i;
}
}
return h;
}
static int lowest(int[] a, int size)
{
int s = a[0];
int l = 0;
for (int i = 0; i < 3; i++)
{
if (s > a[i])
{
l = i;
}
else if (s < a[i])
{
l = 0;
}
}
return l;
}
static void Main(string[] args)
{
Console.WriteLine("Enter the size");
String size = Console.ReadLine();
int N = Convert.ToInt16(size);
String[] Name = new string[N];
String[] Enrollment = new string[N];
int[] marks = new int[N];
Console.WriteLine("Enter Data For students ");
for (int i = 0; i < 3; i++)
{
Console.WriteLine("Enter Name for Student {0} ", i);
Name[i] = Console.ReadLine();
Console.WriteLine("Enter Enrollment for Student {0} ", i);
Enrollment[i] = Console.ReadLine();
Console.WriteLine("Enter Marks for Student {0} ", i);
marks[i] = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine("\n\nName\t\tEnrollment\tMarks");
for (int i = 0; i < 3; i++)
{
Console.Write("{0}\t\t", Name[i]);
Console.Write("{0}\t\t", Enrollment[i]);
Console.WriteLine("{0}\t", marks[i]);
}
//Console.WriteLine("\n\nStudent With highest and Lowest Marks");
int h= highest(marks, N);
int l= lowest(marks, N);
Console.WriteLine("Record of student With highest marks \n\n");
Console.WriteLine("{0}\t\t{1}\t\t{2} ", Name[h], Enrollment[h], marks[h]);
Console.WriteLine("Record of student With Lowest marks\n\n");
Console.WriteLine("{0}\t\t{1}\t\t{2} ", Name[l], Enrollment[l], marks[l]);
Console.ReadLine();
}
}
}
No comments:
Post a Comment