We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

www.vustudents.ning.com

Looking For Something at vustudents.ning.com? Click Here to Search

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

# CS508 Modern Programming Languages Assignment 4 DeadLine Feb 6 2017

Assignment Question :

You are required to write a program in C# programming language which will get a numeric value from user and show two prime numbers whose addition is equal to the number entered by user. You need to show all combination of prime numbers.

Assignment Instructions:

• Find two prime numbers whose addition will be equal to user entered number.
• Find all possible combinations of prime number whose addition will be equal to number entered by user.

Hints:

To make the solution easily first you need to understand the problem with an example.

• Suppose user entered the number 36. So you have N = 36.
• Iterate from 2 to N/2 and find a prime number. Subtract the prime number from 36, if remaining is also prime number then you found two prime numbers whose sum is equal to user’s entered number. You can see its working in Sample Output video.
• isPrime(n) method you created in Assignment no. 3 will help you to check a number is prime or not. Just you need to change it from Java to C# syntax.

Sample Output:

For sample output watch Sample Output video file.

Assignment Submission Instructions:

If you do not have Microsoft Visual Studio to make program in C# then use online tool given on http://volatileread.com/UtilityLibrary/SnippetCompiler

The procedure to use online tool is showing in Sample Output video file.

Please note that due date of assignment will not extend, so do not wait for last date and submit your solution as quickly as possible.

Due Date: Tuesday, February 06, 2017.

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?

See Your Saved Posts Timeline

Views: 2462

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

### Replies to This Discussion

Here is My Solution
share your solution

ammar bhai is ka code send kryn aysy to nzr e nai aa raha hay.

code to itny logo ne share kr dia :)

using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
public static void Main()
{
Program obj = new Program();

string number;

Console.WriteLine("Enter a positive number:");
number = Console.ReadLine();
double Number = Convert.ToDouble(number);

double result = Number/2;

double num1,second,final;

bool flag=false;

for(double i=2; i<=result; i++){ if(obj.isprimenumber(i)){ num1 = Number-i; if(obj.isprimenumber(num1)){ Console.WriteLine(num1+" + "+i+" = "+Number); flag = true; } } } if(flag){ Console.Write("All combinations found."); }else{ Console.Write(Number+" can not be expressed as the sum of two prime numbers."); } } public bool isprimenumber(double num){ for (int i = 2; i <= num / 2; i++) { if (num % i == 0) { return false; } return true; } return false; } } http://volatileread.com/utilitylibrary/snippetcompiler?id=104572

ye ghalat hy

to bhai ap theek wala share kr k dikha do

Program obj = new Program();
string number;
Console.WriteLine("Enter a positive number:");
number = Console.ReadLine();
double Number = Convert.ToDouble(number);
double result = Number/2;
double num1;
bool flag=false;
for(double i=2; i<=result; i++)

if(obj.isprimenumber(i))
{ num1 = Number-i; if(obj.isprimenumber(num1))
{ Console.WriteLine(num1+" + "+i+" = "+Number);
flag = true; } } } if(flag)
{ Console.Write("All combinations found.");
Console.ReadKey();
}
else
{ Console.Write(Number+" can not be expressed as the sum of two prime numbers.");
Console.ReadKey();
}
Console.WriteLine("Enter a positive number:");
number = Console.ReadLine();

ye bhi ghalat hy

Abrar Ahmed (BSSE) plz share correct solution if you did

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions. Read More>>

Note:-

For Important Helping Material related to this subject (Solved MCQs, Short Notes, Solved past Papers, E-Books, FAQ,Short Questions Answers & more). You must view all the featured Discussion in this subject group.

For how you can view all the Featured discussions click on the Back to Subject Name Discussions link below the title of this Discussion & then under featured Discussion corner click on the view all link.

Or visit this link

Click Here For Detail.

&

.•°How to Download past papers from study groups°•.

Please Click on the below link to see…

.... How to Find Your Subject Study Group & Join ....

please help me

out put main sum mix a raha hai.

odd aur prime. likin prime akaila nahin aaraha hai

how i manage it. thanks

## Latest Activity

M Abdul Wahab Khalid joined +M.Tariq Malik's group

### CS401 Computer Architecture and Assembly Language Programming

18 minutes ago
Shahid and Rabia Imran are now friends
25 minutes ago
44 minutes ago
44 minutes ago
+M.Tariq Malik's discussion was featured

### MTH101 Calculus And Analytical Geometry Practice Questions Solutions Lectures 1 to 22

44 minutes ago
44 minutes ago
+M.Tariq Malik added a discussion to the group MTH101 Calculus And Analytical Geometry

### MTH101 Calculus And Analytical Geometry Practice Questions Solutions Lectures 1 to 22

45 minutes ago
+M.Tariq Malik added a discussion to the group MGT402 Cost & Management Accounting

47 minutes ago
49 minutes ago

## Today Top Members

1

2

3

### + ! zεε

© 2020   Created by +M.Tariq Malik.   Powered by

.