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 |
void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(“%d”,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(“%d”,*cptr); }
1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.
void main() { while(1){ if(printf("%d",printf("%d"))) break; else continue; } }
How can i find first 5 natural Numbers without using any loop in c language????????
main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above
Given n nodes. Find the number of different structural binary trees that can be formed using the nodes.
16 Answers Aricent, Cisco, Directi, Qualcomm,
void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }
main() { clrscr(); } clrscr();
main() { printf("%d", out); } int out=100;
main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }
#define prod(a,b) a*b main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }
write a c program to print magic square of order n when n>3 and n is odd?