-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2eab510
commit 28704ae
Showing
49 changed files
with
517 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!-- Use CTRL+K+V if you are in VS code --> | ||
|
||
## Question [11] | ||
|
||
WAP to accept EMPLOYEE details Name. Designation, Gender. DOJ and Salary)\ | ||
Define function members to compute\ | ||
i)total number of employees\ | ||
ii)total number of employees with salaries greater than 20k | ||
|
||
## Code | ||
|
||
```c | ||
#include <stdio.h> | ||
struct employee | ||
{ | ||
char name[30]; | ||
char designation[30]; | ||
char gender[10]; | ||
int doj; | ||
float salary; | ||
}; | ||
|
||
int main() | ||
{ | ||
struct employee emp[10]; | ||
int n, empCount = 0, highSalCount = 0; | ||
printf("\nEnter the number of employees: "); | ||
scanf("%d", &n); | ||
for (int i = 0; i < n; i++) | ||
{ | ||
printf("\nEMPLOYEE %d:- ", i + 1); | ||
printf("\nEnter the name of employee: "); | ||
scanf(" %[^\n]s", emp[i].name); | ||
printf("Enter the Designation of employee: "); | ||
scanf(" %[^\n]s", emp[i].designation); | ||
printf("Enter the gender of employee: "); | ||
scanf(" %[^\n]s", emp[i].gender); | ||
printf("Enter the Date of joining of employee: "); | ||
scanf("%d", &emp[i].doj); | ||
printf("Enter the Salary of employee: "); | ||
scanf("%f", &emp[i].salary); | ||
empCount++; | ||
if (emp[i].salary > 20000) | ||
{ | ||
highSalCount++; | ||
} | ||
} | ||
printf("\nTotal No of Employees: %d", empCount); | ||
printf("\nTotal No of Employees with Salary greater than 20k: %d", highSalCount); | ||
printf("\n"); | ||
} | ||
``` | ||
|
||
## Output | ||
|
||
![Output](/src/output/11-o_p.png) | ||
|
||
## Code | ||
|
||
![Code](../src/output/11-code.png) | ||
|
||
<!-- | ||
Note: if you are using text-editor to view this document I highly recommend you to use vs code or sublime text so its easier to read the contents of the file | ||
VS Code - https://code.visualstudio.com/download | ||
Sublime Text - https://www.sublimetext.com/download | ||
--!> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <stdio.h> | ||
struct employee | ||
{ | ||
char name[30]; | ||
char designation[30]; | ||
char gender[10]; | ||
int doj; | ||
float salary; | ||
}; | ||
|
||
int main() | ||
{ | ||
struct employee emp[10]; | ||
int n, empCount = 0, highSalCount = 0; | ||
printf("\nEnter the number of employees: "); | ||
scanf("%d", &n); | ||
for (int i = 0; i < n; i++) | ||
{ | ||
printf("\nEMPLOYEE %d:- ", i + 1); | ||
printf("\nEnter the name of employee: "); | ||
scanf(" %[^\n]s", emp[i].name); | ||
printf("Enter the Designation of employee: "); | ||
scanf(" %[^\n]s", emp[i].designation); | ||
printf("Enter the gender of employee: "); | ||
scanf(" %[^\n]s", emp[i].gender); | ||
printf("Enter the Date of joining of employee: "); | ||
scanf("%d", &emp[i].doj); | ||
printf("Enter the Salary of employee: "); | ||
scanf("%f", &emp[i].salary); | ||
empCount++; | ||
if (emp[i].salary > 20000) | ||
{ | ||
highSalCount++; | ||
} | ||
} | ||
printf("\nTotal No of Employees: %d", empCount); | ||
printf("\nTotal No of Employees with Salary greater than 20k: %d", highSalCount); | ||
printf("\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!-- Use CTRL+K+V if you are in VS code --> | ||
|
||
## Question [9] | ||
|
||
WAP to display Fibonacci Series using Recursion | ||
|
||
## Code | ||
|
||
```c | ||
#include <stdio.h> | ||
int fibonacci(int n) | ||
{ | ||
if (n <= 1) | ||
return n; | ||
return fibonacci(n - 1) + fibonacci(n - 2); | ||
} | ||
int main() | ||
{ | ||
int n, a = 0, b = 1, tmp; | ||
printf("Enter N: "); | ||
scanf("%d", &n); | ||
for (int i = 0; i < n; i++) | ||
{ | ||
printf("%d ", fibonacci(i)); | ||
} | ||
printf("\n"); | ||
return 0; | ||
} | ||
``` | ||
## Output | ||
![Output](/src/output/9-o_p.png) | ||
## Code | ||
![Code](../src/output/9-code.png) | ||
<!-- | ||
Note: if you are using text-editor to view this document I highly recommend you to use vs code or sublime text so its easier to read the contents of the file | ||
VS Code - https://code.visualstudio.com/download | ||
Sublime Text - https://www.sublimetext.com/download | ||
--!> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <stdio.h> | ||
int fibonacci(int n) | ||
{ | ||
if (n <= 1) | ||
return n; | ||
return fibonacci(n - 1) + fibonacci(n - 2); | ||
} | ||
int main() | ||
{ | ||
int n, a = 0, b = 1, tmp; | ||
printf("Enter N: "); | ||
scanf("%d", &n); | ||
for (int i = 0; i < n; i++) | ||
{ | ||
printf("%d ", fibonacci(i)); | ||
} | ||
printf("\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<!-- Use CTRL+K+V if you are in VS code --> | ||
|
||
## Question [10] | ||
|
||
WAP to search for an Element in an Array using functions | ||
|
||
## Code | ||
|
||
```c | ||
#include <stdio.h> | ||
int search(int ar[], int n, int key) | ||
{ | ||
for (int i = 0; i < n; i++) | ||
{ | ||
if (ar[i] == key) | ||
{ | ||
return 1; | ||
break; | ||
} | ||
} | ||
return 0; | ||
} | ||
int main() | ||
{ | ||
int ar[20], key, n; | ||
printf("\nEnter Size of Array: "); | ||
scanf("%d", &n); | ||
printf("\nEnter Elements of Array: \n"); | ||
for (int i = 0; i < n; i++) | ||
{ | ||
scanf("%d", &ar[i]); | ||
} | ||
printf("\nEnter Element to be searched: "); | ||
scanf("%d", &key); | ||
if (search(ar, n, key)) | ||
{ | ||
printf("\nElement found in Array\n"); | ||
} | ||
else | ||
{ | ||
printf("\nElement not found in Array\n"); | ||
} | ||
} | ||
``` | ||
## Output | ||
![Output](/src/output/10-o_p.png) | ||
## Code | ||
![Code](../src/output/10-code.png) | ||
<!-- | ||
Note: if you are using text-editor to view this document I highly recommend you to use vs code or sublime text so its easier to read the contents of the file | ||
VS Code - https://code.visualstudio.com/download | ||
Sublime Text - https://www.sublimetext.com/download | ||
--!> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <stdio.h> | ||
int search(int ar[], int n, int key) | ||
{ | ||
for (int i = 0; i < n; i++) | ||
{ | ||
if (ar[i] == key) | ||
{ | ||
return 1; | ||
break; | ||
} | ||
} | ||
return 0; | ||
} | ||
int main() | ||
{ | ||
int ar[20], key, n; | ||
printf("\nEnter Size of Array: "); | ||
scanf("%d", &n); | ||
printf("\nEnter Elements of Array: \n"); | ||
for (int i = 0; i < n; i++) | ||
{ | ||
scanf("%d", &ar[i]); | ||
} | ||
printf("\nEnter Element to be searched: "); | ||
scanf("%d", &key); | ||
if (search(ar, n, key)) | ||
{ | ||
printf("\nElement found in Array\n"); | ||
} | ||
else | ||
{ | ||
printf("\nElement not found in Array\n"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Oops, something went wrong.