Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added session_1/screenshots/Screenshot 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added session_1/screenshots/Screenshot 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added session_1/screenshots/Screenshot 3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added session_1/screenshots/Screenshot 4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions session_1/solution/Question_1.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'dart:io';

void main() {
int N = takeInput();
runSeries(N);
}

int takeInput() {
print("Enter number of terms of the series");
int? N = int.parse(stdin.readLineSync()!);
return N;
}

void runSeries(int n) {
int a = 0;
int b = 1;
int c = a + b;
if (n < 1) {
print("Invalid input");
} else {
for (int i = 1; i <= n; i++) {
print(a);
a = b;
b = c;
c = a + b;
}
}
}
55 changes: 55 additions & 0 deletions session_1/solution/Question_2.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'dart:io';
import 'dart:math';

void main() {
int N = takeInput();
bool res = check(N);
if (res == true) {
print("Semiprime number");
} else {
print("Not a semiprime number");
}
}

int takeInput() {
print("Enter number");
int? N = int.parse(stdin.readLineSync()!);
return N;
}

check(int N) {
int l = sqrt(N).toInt();
for (int i = 2; i <= l; i++) {
if (N % i == 0) {
bool res_1 = checkPrime(i);
if (res_1 == true) {
int j = N ~/ i;
if ((j * i == N) && (j != i)) {
bool res_2 = checkPrime(j);
if (res_2 == true) {
return true;
}
}
}
}
}
return false;
}

checkPrime(int n) {
if (n > 1) {
int count = 0;
for (int i = 2; i < n; i++) {
if (n % i == 0) {
count += 1;
}
}
if (count == 0) {
return true;
} else {
return false;
}
} else {
return false;
}
}
54 changes: 54 additions & 0 deletions session_1/solution/Question_3.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import 'dart:io';

void main() {
takeInput();
}

check(arr) {
int sum = 0;
bool res;
for (int j = 0; j < arr.length; j++) {
int x = arr[j];
res = checkPrime(x);
if (res == true) {
sum += x;
}
}
print("Sum of prime numbers in the array: $sum");
res = checkPrime(sum);
if (res == true) {
print("Sum of prime numbers of the array is prime");
} else {
print("Sum of prime numbers of the array is not prime");
}
}

bool checkPrime(int x) {
int count = 0;
if (x > 1) {
for (int i = 2; i < x; i++) {
if (x % i == 0) {
count += 1;
}
}
if (count == 0) {
return true;
} else {
return false;
}
} else {
return false;
}
}

takeInput() {
print("Enter number of elements of array");
int? N = int.parse(stdin.readLineSync()!);
List<int> arr = [];
for (int i = 0; i < N; i++) {
print("Enter element ${i + 1}");
int? x = int.parse(stdin.readLineSync()!);
arr.add(x);
}
check(arr);
}
105 changes: 105 additions & 0 deletions session_1/solution/Question_4.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import 'dart:io';

class BranchElective {
List<String> B_CN = []; //List containing branch elective course name
List<String> B_CD = []; //List containing branch elective course code
List<String> br = []; //List containing branch name
List<int> yr = []; //List containing year

String? courseName;
String? courseCode;
String? branch;
int? year;

void takeInput() {
print("Enter name of branch:");
branch = stdin.readLineSync();
br.add(branch!);
print("Enter year:");
year = int.parse(stdin.readLineSync()!);
yr.add(year!);
print("Enter course name:");
courseName = stdin.readLineSync();
B_CN.add(courseName!);
print("Enter course code:");
courseCode = stdin.readLineSync();
B_CD.add(courseCode!);
}

void display() {
bool found = false;
print("Enter name of branch:");
branch = stdin.readLineSync();
print("Enter year:");
year = int.parse(stdin.readLineSync()!);
for (int i = 0; i < br.length; i++) {
if ((br[i] == branch) && (year == yr[i])) {
found = true;
print("Course name: ${B_CN[i]} Course code:${B_CD[i]}");
}
}
if (found == false) {
print("No courses have been added");
}
}
}

class OpenElective {
List<String> O_CN = []; //List containing open elective course name
List<String> O_CD = []; //List containing branch elective course code

String? courseName;
String? courseCode;

void takeInput() {
print("Enter course name:");
courseName = stdin.readLineSync();
O_CN.add(courseName!);
print("Enter course code:");
courseCode = stdin.readLineSync();
O_CD.add(courseCode!);
}

void display() {
if (O_CD.length == 0) {
print("No courses have been added");
} else {
print("Courses are:");
for (int i = 0; i < O_CD.length; i++) {
print("Course name: ${O_CN[i]} Course code:${O_CD[i]}");
}
}
}
}

void main() {
var BE = new BranchElective();
var OE = new OpenElective();

int? i = 1;

while (i == 1) {
print("Enter type of user 1.Admin 2.Student");
int? ch_1 = int.parse(stdin.readLineSync()!);
print("Enter course type 1.Open elective 2.Branch elective");
int? ch_2 = int.parse(stdin.readLineSync()!);
if (ch_2 == 1) {
if (ch_1 == 1) {
OE.takeInput();
}
if (ch_1 == 2) {
OE.display();
}
}
if (ch_2 == 2) {
if (ch_1 == 1) {
BE.takeInput();
}
if (ch_1 == 2) {
BE.display();
}
}
print("Press 1 to continue and 0 to exit");
i = int.parse(stdin.readLineSync()!);
}
}
46 changes: 46 additions & 0 deletions session_3/solutions/number_trivia/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
10 changes: 10 additions & 0 deletions session_3/solutions/number_trivia/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 77d935af4db863f6abd0b9c31c7e6df2a13de57b
channel: stable

project_type: app
9 changes: 9 additions & 0 deletions session_3/solutions/number_trivia/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Number Trivia

Fun facts about your favorite number just a click away!

## App in action

<img src="./pics/app.gif" width="200">


29 changes: 29 additions & 0 deletions session_3/solutions/number_trivia/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
13 changes: 13 additions & 0 deletions session_3/solutions/number_trivia/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
Loading