Code

Hc?9s=7ck#, [Code_number] ,[Name] , [Address] ,[contact number] ,[identification card] , [Sex] , [Shirt_blue] [Good] ,

Views 348 Downloads 0 File size 181KB

Report DMCA / Copyright

DOWNLOAD FILE

Recommend stories

Citation preview

Hc?9s=7ck#, [Code_number] ,[Name] , [Address] ,[contact number] ,[identification card] , [Sex]

, [Shirt_blue] [Good] , [Thirteen] ,[Breast] , [Waist] , [Caller's] , [Waist_fitting] , [Shirt_wife] [Shlover_Labbai] , [Capital] , [Confidentiality] , [Shout_pocket] , [Front_picture] , [Shirt] , [Saeed_Pocket] ,[collar] , [Ben] , [Cuff]

Q1 Simple Array Sum Given an array of integers, can you find the sum of its elements? Input Format The first line contains an integer, , denoting the size of the array. The second line contains space-separated integers representing the array's elements. Output Format Print the sum of the array's elements as a single integer. Sample Input 6

1 2 3 4 10 11

Sample Output 31

Explanation We print the sum of the array's elements, which is: .

Q2 Birthday cake candles Colleen is turning years old! Therefore, she has candles of various heights on her cake, and candle has height . Because the taller candles tower over the shorter ones, Colleen can only blow out the tallest candles. Given the for each individual candle, find and print the number of candles she can successfully blow out. Input Format The first line contains a single integer, , denoting the number of candles on the cake. The second line contains space-separated integers, where each integer describes the height of candle . Constraints   Output Format Print the number of candles Colleen blows out on a new line. Sample Input 0 4 3 2 1 3

Sample Output 0 2

Explanation 0 We have one candle of height , one candle of height , and two candles of height . Colleen only blows out the tallest candles, meaning the candles where . Because there are such candles, we print on a new line.

Q3 We define super digit of an integer using the following rules:



If has only digit, then its super digit is .



Otherwise, the super digit of is equal to the super digit of the digit-sum of . Here, digitsum of a number is defined as the sum of its digits.

For example, super digit of will be calculated as: super_digit(9875) = super_digit(9+8+7+5) = super_digit(29) = super_digit(2+9) = super_digit(11) = super_digit(1+1) = super_digit(2) = 2.

You are given two numbers and . You have to calculate the super digit of . is created when number is concatenated times. That is, if and , then . Input Format The first line contains two space separated integers, and . Constraints   Output Format Output the super digit of , where is created as described above. Sample Input 0 148 3

Sample Output 0 3

Explanation 0 Here and , so . super_digit(P) = super_digit(148148148) = super_digit(1+4+8+1+4+8+1+4+8) = super_digit(39) = super_digit(3+9)

= super_digit(12) = super_digit(1+2) = super_digit(3) = 3.

using using using using using

System; System.Collections.Generic; System.Linq; System.Text; System.Threading.Tasks;

namespace class_task { class Program { static void Main(String[] args) { int[] arry = { 1,2,3,4,10,11}; Console.WriteLine(arry.Length.ToString()); string arryElements = ""; int result = 0; foreach (int elemt in arry) { result += elemt; arryElements += " "+elemt; } Console.WriteLine(arryElements); Console.WriteLine(result); Console.ReadLine();

}}}

int num, result; pro pg = new pro(); Console.WriteLine("Enter the Number : "); num=int.Parse(Console.ReadLine()); result =pg.sum(num); Console.WriteLine("Sum of Digits in {0} is {1}", num, result); Console.ReadLine(); } } class pro

{ public int sum(int num) { if (num != 0) { return (num % 10 + sum(num / 10)); } else { return 0; https://projecteuler.net/show=all

https://www.w3resource.com/csharp-exercises/