목록전체 글 (45)
bread, coffee and coding
문제 설명 정수를 담고 있는 배열 arr의 평균값을 return하는 함수, solution을 완성해보세요. 제한사항 arr은 길이 1 이상, 100 이하인 배열입니다. arr의 원소는 -10,000 이상 10,000 이하인 정수입니다. 입출력 예 arr return [1,2,3,4] 2.5 [5,5] 5 public class Solution { public double solution(int[] arr) { double answer = 0; double sum =0; for(int i=0; i
문제 설명 이 문제에는 표준 입력으로 두 개의 정수 n과 m이 주어집니다. 별(*) 문자를 이용해 가로의 길이가 n, 세로의 길이가 m인 직사각형 형태를 출력해보세요. 제한 조건 n과 m은 각각 1000 이하인 자연수입니다. 예시 입력 5 3 출력 ***** ***** ***** using System; public class Example { public static void Main() { String[] s; Console.Clear(); s = Console.ReadLine().Split(' '); int a = Int32.Parse(s[0]); int b = Int32.Parse(s[1]); for (int i = 0; i < b; i++) { for (int j = 0; j < a; j++) ..
문제 설명 단어 s의 가운데 글자를 반환하는 함수, solution을 만들어 보세요. 단어의 길이가 짝수라면 가운데 두글자를 반환하면 됩니다. 재한사항 s는 길이가 1 이상, 100이하인 스트링입니다. 입출력 예 sre turn "abcde" "c" "qwer" "we" public class Solution { public string solution(string s) { string answer = s; if(answer.Length % 2 == 0) //문자열의 길이가 짝수 인경우 가운데 두 글자를 반환 해야 하기 때문에 { answer = answer[(answer.Length-1) / 2].ToString() + answer[answer.Length / 2].ToString(); } else {..
그누보드 C# [배열]배열의 기수값 응용 using System; namespace ConsoleApp10 { class Program { static void Main(string[] args) { // 1. 변수선언 int[] arr = new int[10]; // 2. 로직 for(int i = 0; i
영어,국어,수학 성적이 들어있는 정수형 배열 score를 선언하세요 영어 80 국어 90 수학 95 정수형 배열 score 꼭 반복문에 활영하여 평균avg를 구해주세요 단 avg변수는 소수점 둘째자리까지 구해주세요 using System; namespace ConsoleApp9 { class Program { static void Main(string[] args) { int[] score = new int[3]; double avg; int sum = 0; for (int i = 0; i = 0); } } } ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ using System; namespace MyApp_CallByValue { class Program { public static void S..