Write a program that reads a dynamic array of 40
integers and displays only even integers

Answers were Sorted based on User's Feedback



Write a program that reads a dynamic array of 40 integers and displays only even integers..

Answer / guest

logic is:


for(i=0;i<40;i++)
{
if(a[i]%2==0)

{
printf("%d",a[i]);
}

}

Is This Answer Correct ?    3 Yes 1 No

Write a program that reads a dynamic array of 40 integers and displays only even integers..

Answer / mohammedayub.y(c.i.e.t)

#include<stdio.h>
#include<conio.h>
void main()
{
int Array[40],i;
printf("Enter the array elements one by one:\n");
for(i=0;i<40;i++)
{
scanf("%d",&Array[i]);
}
printf("The even integers are:\n");
for(i=0;i<40;i++)
{
if(Array[i]%2==0) printf("%d\n",Array[i]);
}
getch();
}

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Code Interview Questions

Write a program that produces these three columns sequence nos. using loop statement Sequence nos. Squared Squared + 5 1 1 6 2 4 9 3 9 14 4 16 21 5 25 30

1 Answers   GoDB,


main() { char *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }

1 Answers  


void main() { int i; char a[]="\0"; if(printf("%s\n",a)) printf("Ok here \n"); else printf("Forget it\n"); }

3 Answers   Accenture,


int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

2 Answers   Bosch, eInfochips, HCL, IHCL,


write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details

2 Answers   TCS,






create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00

0 Answers   Microsoft,


What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

1 Answers  


main() { extern int i; i=20; printf("%d",i); }

1 Answers   Value Labs,


Write a procedure to implement highlight as a blinking operation

2 Answers  


Write a c program to search an element in an array using recursion

1 Answers   Wipro,


Write a C program to print look and say sequence? For example if u get the input as 1 then the sequence is 11 21 1211 111221 312211 12112221 .......(it counts the no. of 1s,2s etc which is in successive order) and this sequence is used in run-length encoding.

1 Answers  


#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }

1 Answers  


Categories