65 873
Assignments Done
99,1%
Successfully Done
In October 2018

Answer to Question #5621 in C# for akmzubayer

Question #5621
Write a c code only using array and for loop to find similar number among given numbers.?
how many numbers:7
give the numbers:2532655
mode:5
number of time present:3
Expert's answer
using System;
using System.Collections.Generic;
using
System.Linq;
using System.Text;

namespace Similar_number
{
class
Program
{
static void Main(string[] args)
{
string numbers;
int
number;
int mode;
int numberoftimepresent = 0;
Console.Write("How many
numbers: ");
number=int.Parse(Console.ReadLine());
Console.Write("Give the
numbers:");
numbers = Console.ReadLine();
Console.Write("Mode:");
mode
= int.Parse(Console.ReadLine());

for (int i = 0; i < number;i++ )
{
if (mode==int.Parse(numbers[i].ToString())) {
numberoftimepresent +=
1;
}
}
Console.Write("Number of time present:" +
numberoftimepresent.ToString());
Console.WriteLine("\nPress any key to
exit");
Console.ReadLine();
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions