ASSIGNMENT 1
#include<stdio.h>
main()
{
int r,h;
float s,v;
printf("Enter radius and height of a cylinder");
scanf("%d%d",&r,&h);
s=(2*3.14*r*r)+ (2*3.14*r*h);
v=3.14*r*r*h;
printf("Surface Area=%f Volume=%f",s,v);
}
1. Problem solving steps – writing algorithms and flowcharts.
#include<stdio.h>
main()
{
int r,h;
float s,v;
printf("Enter radius and height of a cylinder");
scanf("%d%d",&r,&h);
s=(2*3.14*r*r)+ (2*3.14*r*h);
v=3.14*r*r*h;
printf("Surface Area=%f Volume=%f",s,v);
}
ASSIGNMENT NO 1)
TO DEMONSTRATE THE USE OF DATA TYPES, SIMPLE OPERATORS AND EXPRESSIONS
You should read following topics before starting this exercise
1. Problem solving steps – writing algorithms and flowcharts.
2. Different basic data types in C and rules of declaring variables in C.
3. Different operators and operator symbol.
4. How to construct expressions in C, operator precedence.
No comments:
Post a Comment