0% found this document useful (0 votes)
53 views

Rebuilt.c Programming

This document contains 5 C programming questions and their solutions. Each question provides an algorithm to solve the problem, coding examples to implement the algorithm, and sample outputs. The questions cover generating tables, calculating percentages, simple interest, and converting between temperature scales. The questions are part of a practical file for a C programming course completed by Priya Singh.

Uploaded by

AmanSingh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Rebuilt.c Programming

This document contains 5 C programming questions and their solutions. Each question provides an algorithm to solve the problem, coding examples to implement the algorithm, and sample outputs. The questions cover generating tables, calculating percentages, simple interest, and converting between temperature scales. The questions are part of a practical file for a C programming course completed by Priya Singh.

Uploaded by

AmanSingh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

C PROGRAMMING PRACTICAL FILE

Priya Singh.

Q. Write a program to generate the following table:
1992 17421
1993 29210
1994 100523
Algorithm:
Start.
Write the statement to display the given table.
Stop.

Coding:
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("\t1992\t\t17421\n\t1993\t\t29210\n\t1994\t\t100523\n");
getch();
}

Output:






C PROGRAMMING PRACTICAL FILE

Priya Singh.

Q. Write a program to display the following table:
SUBJECTS MARKS
Physics 90
Chemistry 77
Maths 69
Algorithm:
Start.
Write the statement to display the given table.
Stop.

Coding:
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("SUBJECTS\t\tMARKS\nPhysics\t\t\t90\nChemistry\t\t77\nMaths\t\t\t69\n");
getch();
}
Output:







C PROGRAMMING PRACTICAL FILE

Priya Singh.

Q. Write a program to calculate marks of five subjects and find percentage.

Algorithm:
Start.
Take seven variables-eng, maths, phy, TC, C, total, per.
Initialize eng, maths, phy, TC, C.
Calculate total of all five subjects and its percentage.
Display the result that is, total and percentage.
Stop.

Coding:
#include<stdio.h>
#include<conio.h>
void main()
{
float eng,maths,phy,TC,C,total,per;
clrscr();
printf("Enter the marks for English ");
scanf("%f",&eng);
printf("Enter the marks for Maths ");
scanf("%f",&maths);
printf("Enter the marks for Physics ");
scanf("%f",&phy);
printf("Enter the marks for TC ");
scanf("%f",&TC);
printf("Enter the marks for C ");
scanf("%f",&C);
total=eng+maths+phy+TC+C;
printf("Total marks=%f\n",total);
per=(total/500)*100;
printf("Percentage=%f\n",per);

Output:


C PROGRAMMING PRACTICAL FILE

Priya Singh.

Q. Write a program to find simple interest.

Algorithm:
Start.
Take four variables-p, r, t, SI.
Initialize the value of p, r, t.
Calculate simple interest.
Display the output that is, simple interest.
Stop.

Coding:
#include<stdio.h>
#include<conio.h>
void main()
{
float p,r,t,SI;
clrscr();
printf("Enter the principle ");
scanf("%f",&p);
printf("Enter the rate ");
scanf("%f",&r);
printf("Enter the time ");
scanf("%f",&t);
SI=(p*r*t)/100;
printf("Simple interest is=%f",SI);
getch();
}

Output:



C PROGRAMMING PRACTICAL FILE

Priya Singh.

Q. Write a program to convert temperature from Celsius to Fahrenheit.

Algorithm:
Start.
Take two variables-temp, fah.
Initialize the variable temp.
Calculate temperature in Fahrenheit by using formula= (9*(temp+32))/5.
Display the output that is, temperature in Fahrenheit.
Stop.

Coding:
#include<stdio.h>
#include<conio.h>
void main()
{
floattemp,fah;
clrscr();
printf("Enter the temperature in celcius ");
scanf("%f",&temp);
fah=(9*(temp+32))/5;
printf("Temperature in fahrenheit = %f",fah);
getch();
}

Output:




C PROGRAMMING PRACTICAL FILE

Priya Singh.

You might also like