Solved Question Paper 1

Page 1

Appendix

+ Solved Question Papers

C Programming and Data Structures May/June 2007 SET- 1 1.

(a) Write a program to determine and print the sum of the following harmonic series for a given value of n:1+1/2+1/3+1/4+1/5 +1/n. #include<stdio.h> #include<conio.h> main() { int i,n; float sum=0; clrscr(); printf( enter the value of n ); scanf( %d ,&n); for(i=1;i<=n;i++) sum+=1/(float)i; printf( the value of the given series is %f\n ,sum); getch(); }

(b) What are the logical operators used in C ? Illustrate with examples. Logical operators used in C language are && logical AND || logical OR ! logical NOT

Appendix-C.p65

1

7/29/08, 5:21 PM


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.