Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

C# Programming Problem and Solution – Letter Occurrence


Problem: Write a program that outputs the index of the first occurrence of the Letter in a string.

Solution:


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

namespace Problem19{
 class Program{
  static void Main(string[] args){
   String word = "program";
   String letter = "a";

   if (word.Contains(letter)){
    Console.WriteLine("Contains a");
   }
   else{
    Console.WriteLine("Does not contain a");
   }
   Console.ReadKey();
  }
 }
}

Video:

The code is posted here: http://more-codes.com/problems.php

Github Link: problem17.cs

Github Repository: Easy Problems

For more C# Programing Problems and Solutions, please visit us at more-codes.com

Facebook: Like Us!
Twitter: Follow Us!
Thank you very much.


The post C# Programming Problem and Solution – Letter Occurrence appeared first on MoreCodes.

Share the post

C# Programming Problem and Solution – Letter Occurrence

×

Subscribe to Morecodes | Learn Programming Problems And Solutions In C,c++, Java, D, Vb.net, C#, F#, Ruby, Python

Get updates delivered right to your inbox!

Thank you for your subscription

×