TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
anti virus
NA
17
3.5k
while loop that is repeated
Dec 14 2018 5:38 PM
while loop that is repeated if i is less than twice j. Inside the loop double the value of i and decrement j.
Count the number of times the loop is executed
using System;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
int i = 1; int j = 10;
int count = 0;
while(i<(2*j))
{
i++;
count++;
}
Console.WriteLine("The loop repeated " + count + " times and now j is " + j + " and i is " + i);
}
}
}
Reply
Answers (
3
)
return value from a method
nested if's statements