TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Christos Alexiou
NA
61
0
C# program problem!
Mar 25 2010 11:54 AM
Hi to everyone,
I'm newbie here and in C# also. I'd like to give you congratulations about this forum!
I'd like also to ask you how to insert values in an Array so i can create a dynamic array...
My problem is to make a program to give my grades and return the sum of them!
Source code is provided:
Any help please???
Thanx in advance...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Courses
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Give me the number of courses you have passed:");
String a = Console.ReadLine();
int b = Convert.ToInt16(a);
int sum = 0;
if ((b <= 0) || (b > 20))
{
Console.WriteLine("You gave me wrong number of courses,try again!!!");
}
else
{
int i = 1;
while (i <= b)
{
Console.WriteLine("Give me the grades of your courses,pressing Enter: " + i);
i++;
}
int[] num = new int[20];
for (int j = 1; j < i; j++)
{
string source = Console.ReadLine();
int pin = num[j];
sum = sum + num[j];
}
Console.WriteLine("The suma is: " + sum);
Console.ReadKey();
}
}
}
}
Reply
Answers (
16
)
Date wise Bulk File Copying Application Using C#
Authentication and Authorization