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 |
char *someFun1() { char temp[ ] = “string"; return temp; } char *someFun2() { char temp[ ] = {‘s’, ‘t’,’r’,’i’,’n’,’g’}; return temp; } int main() { puts(someFun1()); puts(someFun2()); }
How to return multiple values from a function?
What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?
Write a C function to search a number in the given list of numbers. donot use printf and scanf
int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().
write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?
void main() { int i=5; printf("%d",i++ + ++i); }
How we print the table of 2 using for loop in c programing?
how to concatenate the two strings
Write a procedure to implement highlight as a blinking operation
Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])
#define prod(a,b) a*b main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }