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
Tom Drayton
NA
3
4.2k
Converting pseudocode to C#
Mar 26 2020 1:43 AM
Does anyone know how to translate the pseudocode below into proper C# code. It is for a forms application where the program outputs all prime numbers between two integer values that are inputed into text boxes. Thanks in advance .
Begin
Clear list box
Initialise num1 and num2
Initialise noPrimes
Validate num1 and num2 as integers (exit if invalid)
If (num1 > num2)
exit
End if
For i = num1 to num2
Initialise count
For j = 2 to (square root of i)
If j is a factor i
Count++
Break out of inner for loop
End if
Next j
If count = 0
Increment noPrimes
Output i as a prime number
End if
Next I
Output the number of primes to the status bar
End
The forms application looks like this
Reply
Answers (
3
)
C# show emails in listview
c# program to create student details using interface