diff --git a/C7/ex3.c b/C7/ex3.c new file mode 100644 index 0000000..7d6b3bf --- /dev/null +++ b/C7/ex3.c @@ -0,0 +1,13 @@ +#include +#include + +int main() { + float radius, height; + + printf("Enter radius: "); + scanf("%f", &radius); + printf("Enter height: "); + scanf("%f", &height); + + printf("Surface area: %f\n", 2*M_PI*radius*radius + 2*M_PI*radius*height); +} diff --git a/C7/ex4.c b/C7/ex4.c new file mode 100644 index 0000000..92bbf40 --- /dev/null +++ b/C7/ex4.c @@ -0,0 +1,11 @@ +#include + +int main() { + char name[200] = { 0 }; + + printf("What is your name? "); + scanf("%s", name); + + printf("Hello %s\n", name); + +} diff --git a/C7/ex5.c b/C7/ex5.c new file mode 100644 index 0000000..f828e8d --- /dev/null +++ b/C7/ex5.c @@ -0,0 +1,15 @@ +#include + +int main() { + char name[200] = { 0 }; + int age = 0; + + printf("What is your name? "); + scanf("%s", name); + + printf("What is your age? "); + scanf("%ud", &age); + + printf("Hello %s\nYou are %d years old\n", name, age); + +}