Wa0034.
Wa0034.
Experiment No. 1
AIM:
Use the formatted input/output statements, operators and
expressions of C language
Program 1
9.End
FLOWCHART:
PROGRAM: #include
<stdio.h> int
main()
{
int a,b; printf("Enter 2 numbers\n");
Program 2
PROBLEM WAP to Convert Celsius to Fahrenheit. Answer should be rounded
STATEMENT : upto 3 decimal places.
ALGORITHM: 1.Start
7. End
FLOWCHART:
RESULT:
Program 3
7. End
FLOWCHART:
PROGRAM: #include<stdio.h>
void main()
float e,m;
scanf("%f",&e);
m=e*0.305;
RESULT:
Program 4
PROBLEM Write a C program to convert days into year, month and days.
STATEMENT:
ALGORITHM: 1.Start
9.Display years.
10.Display months.
11.Display remaining_days.
12.End
FLOWCHART:
PROGRAM: #include <stdio.h>
return 0;
}
RESULT:
Program 5
Create a program that asks the user for a number, calculates its square
PROBLEM
and cube, then prints the results. Write the solution both with and
STATEMENT:
without using the math library.
ALGORITHM: 1. Start the program.
2. Import the math library.
3. Prompt the user to enter a number.
4. Read the user’s input and store it as a variable
5. Calculate the square of the number using math.pow (square=
math.pow(number,2))
6. Calculate the cube of the number using math.pow (cube=
math.pow(number,3)).
7. Print the results.
8. End the program.
FLOWCHART:
Program 6
PROGRAM: #include<stdio.h>
void main()
{
float A,B,C,D,E,Q,R,m1,m2,m3,m4,m5,a1,a2,a3,a4,a5;
printf("The attendance of subject m1");
scanf("%f", &a1);
printf("The attendance of subject m2");
scanf("%f",&a2);
printf("The attendance of subject m3");
scanf("%f",&a3);
printf("The attendance of subject m4");
scanf("%f",&a4);
printf("The attendance of subject m5");
scanf("%f",&a5);
printf("Enter marks of subject 1");
scanf("%f",&m1);
printf("Enter marks of subject 2");
scanf("%f",&m2);
printf("Enter marks of subject 3");
scanf("%f",&m3);
printf("Enter marks of subject 4");
scanf("%f", &m4);
printf("Enter marks of subject 5");
scanf("%f",&m5);
A=m1*a1;
B=m2*a2;
C=m3*a3;
D=m4*a4;
E=m5*a5;
Q=A+B+C+D+E;
R=Q/50.0;
RESULT: