IT22111 Word Record Final
IT22111 Word Record Final
IT22111 Word Record Final
Exp No: 1
Date:
Question:
Commnands : mkdir , cd , mv , rm , ls , cat , vi , cp , etc.,
Aim:
To study the various Linux Commands.
Commands & their Description :
1. Command : mkdir
Description : Creating a new directorty
Usage : $mkdir dirname
Example : $mkdir ECE
Output : $mkdir ECE
$ls
$ECE
2. Command : ls
Description : To list all files and directory
Usage : $ls
Example : $ls
Output : $ECE
3. Command : cd
Description : To change directory
Syntax : $cd dirname
Usage : $cd ECE
Output : $ECE
4. Command : cd..
Description : To come out from a directory
Syntax : $cd..
Usage : $cd..
Output : ~$:
5. Command : cat>
Description : to create a new file
Syntax : $cat>filename.txt
Usage : $cat>sample.txt
Output : Hello
^z
+stopped
7. Command : cat>>
Description : to append content to existing files
Syntax : $cat>>filename.txt
Usage : $cat>>sample.txt
Output : We are from ECE-A!
^z
+stopped
8. Command : cp
Description : to copy contents from one file to another within same directory.
Syntax : $cp oldfile.txt newfile.txt
Usage : $cp sample.txt
$ls
Output : Sample.txt newfile.txt
9. Command : mv
Description : to move a file from aone directory to another
Syntax : $mv sourcedir/newfile.txt
Usage : $mv eceB/info.txt eceA
$ls
Output : Sample.txt
10. Command : rm
Description : to remove a file from a directory
Syntax : rm filename.txt
Usage : $rm sample.txt
$ls
Output : Sample.txt
12. Command : vi
Description : It is a command line , an interactive editor that can be used to
create and edit text
Syntax : vi filename.c
Usage : vi file1.c
13. Command : cc
Result:
Result:
Result:
Output:
Result:
Output:
Result:
Output:
Result:
Result:
Result:
Result:
Result:
Result:
Result:
Result:
(b)1
23
456
7 8 9 10
11 12 13 14 15
Aim: To print the above as output.
Algorithm:
Step 1: Start
Step 2: Declare i and j as loop variables and k for incrementing values
Step 3: use nested for loop for calculation
for(i=1;i<=5;i++)
{ for(j=1;j<=i;j++)
Printf(“%d”,++k);
printf(“\n”);}
Step 4: Stop
Code:
#include<stdio.h>
int main()
{
int i,j,k=0;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d ",++k);
}
printf("\n");
}
}
Result:
Output:
Result:
}
printf("Number of present students: %d\n", precount);
printf("Number of absent students: %d\n", abscount);
}
Output:
Result:
double values[N];
double sum = 0.0;
printf("Enter %d values:\n", N);
for (i = 0; i < N; i++) {
printf("Value %d: ", i + 1);
scanf("%lf", &values[i]);
sum += values[i];
}
double mean = sum / N;
double variance = 0.0;
for (i = 0; i < N; i++) {
variance += pow(values[i] - mean, 2);
}
variance /= (N - 1);
double standardDeviation = sqrt(variance);
printf("\nMean: %.2lf\n", mean);
printf("Variance: %.2lf\n", variance);
printf("Standard Deviation: %.2lf\n", standardDeviation);
return 0;
}
Result:
Result:
return 0;
}
Output:
Result:
Result:
Result:
Result:
Output:
Result:
Result:
Result:
Result:
Output:
Result:
Result:
Output:
Result:
Result:
Output:
Result:
Result:
Result:
Algorithm:
Step 1: Start.
Step 2: Display the menu options:
- Addition
- Subtraction
- Multiplication
- Division
- Increment
- Decrement
Step 4: If the choice (p) is between 1 and 4, prompt the user to enter two numbers (a and b).
- If the choice is 5 or 6, prompt the user to enter one number (a).
Result:
Output:
Result:
b. In the recursive case, return the sum of the last digit of n and the sumOfDigits function called
with the remaining part (n / 10).
Result:
Result:
Result:
Result:
Result:
Student.txt
Result:
new_student.txt
Result:
Output:
Result:
Output:
Result:
Result: