1. The elements of an array can be accessed by its a) name b) index c) dimension d) none of the above Solution: (b) An array is accessed by its index. 2. The elements of array are stored in contiguous memory due to a) This way computer can keep track only the address of the first element and the addresses of other elements can be calculated. b) The architecture of computer does not allow arrays to store other than serially c) Both d) None Solution: (a) This way computer can keep track only the address of the first element and the addresses of other elements can be calc...
Perfect number in C, Pyramid pattern, Number is power of two or not and Sum of series in c programming
Write a C program to check whether a given number (N) is a perfect number or not? [Perfect Number - A perfect number is a positive integer number which is equals to the sum of its proper positive divisors. For example 6 is a perfect number because its proper divisors are 1, 2, 3 and it’s sum is equals to 6.] #include <stdio.h> int main() { int N; scanf("%d",&N); int i, sum=0; for(i=1; i<N;i++) { if(N%i==0) sum+=i; } if(sum==N) printf("\n%d is a perfect number.",N); else printf("\n%d is not a perfect number.",N); } Input Output 8000 8000 is not a perfect number. 8128 8128 is a perfect number. 6 6 is a perfect number. 87 87 is not a perfect number. Write a C program to find sum of following series where t...