0% found this document useful (0 votes)
10 views5 pages

Task 1

The document provides step-by-step instructions for installing the Dev C++ compiler and includes three sample C programs: one for calculating the square root of a number, another for finding the cube of a number, and a third for generating the Fibonacci series. Each program includes code snippets and example outputs. The installation process involves downloading the installer, running it, accepting the license agreement, and configuring initial settings.

Uploaded by

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

Task 1

The document provides step-by-step instructions for installing the Dev C++ compiler and includes three sample C programs: one for calculating the square root of a number, another for finding the cube of a number, and a third for generating the Fibonacci series. Each program includes code snippets and example outputs. The installation process involves downloading the installer, running it, accepting the license agreement, and configuring initial settings.

Uploaded by

n5358188naman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Task 1

Install Dev C++ Compiler

1. Download the installer:

o Go to the SourceForge Dev-C++ page or another trusted source.

o Click the download button to get the installer (usually an .exe file).

2. Run the installer:

o Locate the downloaded .exe file and double-click to start the installation
process.

o The installer might ask for administrator permissions, so click "Yes" if prompted.

3. Choose the language:

o Select your preferred language from the dropdown menu (English is the default).

o Click "OK".

4. Accept the license agreement:

o Review the license agreement and click "I Agree".

5. Select components:

o Choose the components you want to install. Make sure the compiler is selected if
you want to compile code.

o Click "Next".

6. Choose installation location:

o Select the desired installation folder. You can browse and change it if needed.

o Click "Install".

7. Wait for installation:

o The installation process will begin and may take some time.

8. Launch Dev-C++:

o After installation, you can launch Dev-C++ directly or through a desktop shortcut.

9. Initial setup (optional):


o You might be prompted to choose the language, theme, font, and icons for the
IDE.

10. Start coding:

o Dev-C++ is now installed and ready to use.

Task 2

Write a C program to find out square root of a given number

#include <stdio.h> //Header files

#include <math.h>

int main() { //main function

double num, result; //variables

printf("Enter a number: "); //Ask for number

scanf("%f", &num); //read a number float(decimal)

result = sqrt(num); // No check for negative input

printf("Square root of %f is %lf\n", num, result);//Print result

return 0;

Output

Enter a number: 16

Square root of 16.00 is 4.00


TEST CASE INPUT OUT PUT

2. Write a C program to find cube of a number

#include <stdio.h>

#include <math.h>

int main() {

int num;

double cube;

printf("Enter an integer: ");

scanf("%d", &num);

cube = pow(num, 3); // Using pow to compute cube

printf("Cube of %d is %lf\n", num, cube);

return 0;

TEST CASE INPUT OUT PUT


3. Write a c program to find fibonacii series

Fibonacii series

The Fibonacci series is a sequence of numbers where:

Each number is the sum of the two preceding ones.

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...

#include <stdio.h>

int main() {

int a = 0, b = 1, c;

printf("%d\n", a); // First term

printf("%d\n", b); // Second term

c = a + b;

printf("%d\n", c); // 3rd term

a = b;

b = c;

c = a + b;

printf("%d\n", c); // 4th term

a = b;

b = c;

c = a + b;

printf("%d\n", c); // 5th term


a = b;

b = c;

c = a + b;

printf("%d\n", c); // 6th term

return 0;

You might also like