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


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

please share your comment about assignment 508 please anyone start discussion.............


+ Click Here To Join also Our facebook study Group.


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


See Your Saved Posts Timeline

Views: 4398

.

+ http://bit.ly/vucodes (Vu Study Groups By Subject Codes Wise)

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();
int primeNumber = 0;
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])) {
primeNumber++;
}
}
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();
int primeNumber = 0;
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])){
primeNumber++;
}
}
system.out.println();
}
system.ou.println("\nTotal 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();
int primeNumber = 0;
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])){
primeNumber++;
}
}
system.out.println();
}
system.ou.println("\nTotal 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;

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

RSS

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

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service