0% found this document useful (0 votes)
47 views1 page

Group 8: Name Length Integer

The document contains code for two C# console applications. The first application reads in a name as a string, loops through each character and prints it out, then prints the length of the name. The second application reads in an integer, checks if it is odd, and if so prints out all even numbers up to and including that input number in increments of 2.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views1 page

Group 8: Name Length Integer

The document contains code for two C# console applications. The first application reads in a name as a string, loops through each character and prints it out, then prints the length of the name. The second application reads in an integer, checks if it is odd, and if so prints out all even numbers up to and including that input number in increments of 2.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

GROUP 8

NAME LENGTH INTEGER

using System; using System;


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

namespace ConsoleApplication1 namespace ConsoleApplication3


{ {
class Program class Program
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
string name = Console.ReadLine(); int number = 2;
int i; string input = Console.ReadLine();
Console.Write("\n"); int final = Convert.ToInt32(input);
int ctr = 0;
for (i = 0; i < name.Length; i++)
{ if (final % 2 == 1)
ctr = 2;
Console.WriteLine(name[i]);
} while (ctr < final)
Console.Write("\n"); {
Console.WriteLine(name.Length); Console.Write(number);
Console.ReadKey(); number = number + 2;
} ctr = ctr + 2;
}
} Console.ReadKey();
} }
}
}

You might also like