Who could write how to find a prime number in dynamic array?
Answer / basavaraj
class Demo{
static boolean prime(int n){
int c=0;
for(int i=0;i<n;i++){
if(n%i==0){
c++;
}
}
if(c==2){
return true;
}else{
return false;
}
public static void main(String[] args){
int[] arr={2,5,7,6,8,11,14,13,50};
for(int i=0;i<arr.length;i++){
if(prime(arr[i]){
System.out.println(arr[i]+" ");
}
}
}
| Is This Answer Correct ? | 0 Yes | 0 No |
main() { int i = 3; for (;i++=0;) printf(“%d”,i); }
main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above
void main() { char ch; for(ch=0;ch<=127;ch++) printf(“%c %d \n“, ch, ch); }
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
main() { char *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }
#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }
Write a c program to search an element in an array using recursion
Code for 1>"ascii to string" 2>"string to ascii"
1 Answers Aricent, Global Logic,
Write a program that reads a dynamic array of 40 integers and displays only even integers
Is it possible to print a name without using commas, double quotes,semi-colons?
what is oop?
How can you relate the function with the structure? Explain with an appropriate example.