We have been working very hard since 2009 to facilitate in learning Read More. We can't keep up without your support. Donate.

www.vustudents.ning.com

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

# cs 508 Assignment

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

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

Views: 4517

Attachments:

### Replies to This Discussion

cs508 assignmnt solution 2017 -

import java.util.Random;
import java.util.Scanner;
public class Assignment {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Random random = new Random();
System.out.print("Enter the size (rows and columns) of array:");
int n = sc.nextInt();
System.out.println();
//Assign Random Number To Array
int[][] array = new int[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
array[i][j] = random.nextInt(90) + 10;
}
}
//Traversing The Array
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
System.out.print(array[i][j] + " ");
//Check If Prime Number Found
if (isPrime(array[i][j])) {
}
}
System.out.println();
}
System.out.println("Total Prime Numbers Found:" + primeNumber);
}
public static boolean isPrime(int number) {
boolean flag = true;
for (int i = 2; i < number / 2; i++) {
int tmp = number % i;
if (tmp == 0) {
flag = false;
break;
}
}
return flag;
}
}

import java.utill.Random;
import java.utill.Scanner;

public class Assignment
{
public static void main(String[] args) {
Scanner src = new Scanner (System.in);
Random random = new Random();
System.out.print("Enter the size of arrays: ");
int n = sc.nextInt();

system.out.println();

int [][] array = =new int [n][n];

for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
array [i][j] = random.nextIn (bound 90)+10;
}
}
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
system.out.print (array [i][j]+" ");
if (isPrime(array[i][j])){
}
}
system.out.println();
}
}
public static boolean isPrime (int number) {
boolean flag = true;

for (int i=2; i<number/2 i++) {
int tmp = number%i;

if (tmp == 0) {
flag = false;
break;
}
}
return flag;

import java.utill.Random;
import java.utill.Scanner;
public class Assignment
{
public static void main(String[] args) {
Scanner src = new Scanner (System.in);
Random random = new Random();
System.out.print("Enter the size of arrays: ");
int n = sc.nextInt();
system.out.println();
int [][] array = =new int [n][n];
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
array [i][j] = random.nextIn (bound 90)+10;
}
}
for (int i=0; i<n; i++) {
for (int j=0; j<n; j++) {
system.out.print (array [i][j]+" ");
if (isPrime(array[i][j])){
}
}
system.out.println();
}
}
public static boolean isPrime (int number) {
boolean flag = true;
for (int i=2; i<number/2 i++) {
int tmp = number%i;
if (tmp == 0) {
flag = false;
break;
}
}
return flag;

Code notepad mai .java mai save krky upload krna hy LMS py.

## Latest Activity

≋M≋S≋ updated their profile
2 hours ago
+ !! Ήලᵯᵯℹ Ⲥⱨ !! + liked Mani Siddiqui Ex's discussion توبہ کی اُمید
2 hours ago
Anaya updated their profile
2 hours ago
Tasmia Ittba and Rana Shoaib are now friends
2 hours ago
★彡[ꜱʜʏɴᴀ]彡★ liked Naser Javed (BBIT-8)'s discussion Dhoka :X
3 hours ago
3 hours ago
Naser Javed (BBIT-8) posted a discussion

3 hours ago
4 hours ago
4 hours ago

1

2

3

4

5