Sunteți pe pagina 1din 1

Programming in C

Assignment no.1

Write algorithms and draw flow chart to do the following:


1. Check whether a year given by the user is a leap year or not.
2. Given an integer number in seconds as input, print the equivalent time in hours,
minutes, and seconds as output. The recommended output format is something like:
a. 7,322 seconds is equivalent to 2 hours 2 minutes 2 seconds.
3. Print the numbers that do not appear in the Fibonacci series.
4. Print the sum of the following series:

up to n terms where n is given by the user


5. Draw a flowchart to read a number N and print all its divisors.
6. To find the sum of the digits of any given number.
7. To find the sum of N odd numbers.
8. What will be the output of the following program?
int main()
{
int a,b,c;
scanf(“%1d %2d %3d”,&a,&b,&c);
printf(“Sum=%d”,a+b+c);
return 0;
}
[Note: The user input is: 123456 44 544]
9. Write programs to read the values of the variables and print the results
of the computed expressions given below:
(a) a = (b+c)*(b–c)
(b) y = ax2+ bx + c
(c) I=(P*R*T)/100
(d) C = (F–32)/100
(e) A =–(R1/R2+R3)
(f) a =0.5*float1+0.25*integer1 + integer2/0.4 + integer3

S-ar putea să vă placă și