diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/DSA-Bootcamps.iml b/.idea/DSA-Bootcamps.iml deleted file mode 100644 index d6ebd48..0000000 --- a/.idea/DSA-Bootcamps.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index e208459..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 143bdad..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1dd..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index a6bb565..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "java.project.sourcePaths": [ - "Arnav Sharma/Assignment-0/if-else", - "Arnav Sharma/Assignment-0/Loops" - ] -} diff --git a/AnkitaDam/AnkitaDam.txt b/AnkitaDam/AnkitaDam.txt deleted file mode 100644 index e69de29..0000000 diff --git a/AnkitaDam/IfElse/absolute.txt b/AnkitaDam/IfElse/absolute.txt deleted file mode 100644 index 23ada1d..0000000 --- a/AnkitaDam/IfElse/absolute.txt +++ /dev/null @@ -1,13 +0,0 @@ -#include -using namespace std; - -int main() -{ - int num; - cin >> num; - if(num>=0) - cout << "Absolute value of " << num << " is: " << num; - else - cout << "Absolute value of " << num << " is: " << -1 * num ; - return 0; -} \ No newline at end of file diff --git a/AnkitaDam/IfElse/allowedforexam.txt b/AnkitaDam/IfElse/allowedforexam.txt deleted file mode 100644 index 2078def..0000000 --- a/AnkitaDam/IfElse/allowedforexam.txt +++ /dev/null @@ -1,16 +0,0 @@ -#include -using namespace std; - -int main() -{ - int held, attended; - float percent; - cin >> held >> attended; - percent = (attended * 100.0) / held; - cout << "Attendance percentage: " << percent << "\n"; - if(percent>=75) - cout <<"Allowed for exam"; - else - cout <<"Not allowed for exam"; - return 0; -} \ No newline at end of file diff --git a/AnkitaDam/IfElse/allowedforexamifmedicalcause.txt b/AnkitaDam/IfElse/allowedforexamifmedicalcause.txt deleted file mode 100644 index 0ae956e..0000000 --- a/AnkitaDam/IfElse/allowedforexamifmedicalcause.txt +++ /dev/null @@ -1,23 +0,0 @@ -#include -using namespace std; - -int main() -{ - int held, attended; - char med; - float percent; - cin >> held >> attended; - cout << "Medical cause (Y/N): \n"; - cin >> med; - percent = (attended * 100.0) / held; - cout << "Attendance percentage: " << percent << "\n"; - if(percent>=75) - cout <<"Allowed for exam"; - else{ - if(med=='Y') - cout <<"Allowed for exam considering medical cause"; - else - cout <<"Not allowed for exam"; - } - return 0; -} \ No newline at end of file diff --git a/AnkitaDam/IfElse/bonusamount.txt b/AnkitaDam/IfElse/bonusamount.txt deleted file mode 100644 index c8bd46b..0000000 --- a/AnkitaDam/IfElse/bonusamount.txt +++ /dev/null @@ -1,15 +0,0 @@ -#include -using namespace std; - -int main() -{ - int bonusper,salary,yos; - bonusper = 5; - cin >> salary; - cin >> yos; - if(yos>5) - cout << "Bonus: " << (bonusper*salary)/100.0; - else - cout<<"Bonus: " << 0; - return 0; -} \ No newline at end of file diff --git a/AnkitaDam/IfElse/checksquare.txt b/AnkitaDam/IfElse/checksquare.txt deleted file mode 100644 index 82389f1..0000000 --- a/AnkitaDam/IfElse/checksquare.txt +++ /dev/null @@ -1,15 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int length,breadth; - cin >> length; - cin >> breadth; - if(length==breadth) - cout<<"Is a square"; - else - cout <<"Not a square"; - return 0; -} \ No newline at end of file diff --git a/AnkitaDam/IfElse/grade.txt b/AnkitaDam/IfElse/grade.txt deleted file mode 100644 index d87a6e9..0000000 --- a/AnkitaDam/IfElse/grade.txt +++ /dev/null @@ -1,21 +0,0 @@ -#include -using namespace std; - -int main() -{ - int marks; - cin >> marks; - if(marks<25) - cout <<"Grade: F"; - else if(marks>=25 && marks<45) - cout <<"Grade: E"; - else if(marks>=45 && marks<50) - cout <<"Grade: D"; - else if(marks>=50 && marks<60) - cout <<"Grade: C"; - else if(marks>=60 && marks<80) - cout <<"Grade: B"; - else - cout << "Grade: A"; - return 0; -} \ No newline at end of file diff --git a/AnkitaDam/IfElse/greatestint.txt b/AnkitaDam/IfElse/greatestint.txt deleted file mode 100644 index cb07861..0000000 --- a/AnkitaDam/IfElse/greatestint.txt +++ /dev/null @@ -1,15 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int n1,n2; - cin >> n1; - cin >> n2; - if(n1>n2) - cout< -using namespace std; - -int main() -{ - int year; - cin >> year; - if((year%4==0 && year%100!=0) || (year%4==0 && year%400==0)) - cout <<"Leap year"; - else - cout <<"Not a leap year"; - return 0; -} \ No newline at end of file diff --git a/AnkitaDam/IfElse/loweroruppercase.txt b/AnkitaDam/IfElse/loweroruppercase.txt deleted file mode 100644 index 89af291..0000000 --- a/AnkitaDam/IfElse/loweroruppercase.txt +++ /dev/null @@ -1,15 +0,0 @@ -#include -using namespace std; - -int main() -{ - char c; - cin >> c; - if(c>=65 && c<=90) - cout<<"Uppercase"; - else if(c>=97 && c<=122) - cout<<"Lowercase"; - else - cout<<"Not an alphabet"; - return 0; -} \ No newline at end of file diff --git a/AnkitaDam/IfElse/oldestnyoungest.txt b/AnkitaDam/IfElse/oldestnyoungest.txt deleted file mode 100644 index 93b81a4..0000000 --- a/AnkitaDam/IfElse/oldestnyoungest.txt +++ /dev/null @@ -1,35 +0,0 @@ -#include -using namespace std; - -int main() -{ - int age1,age2,age3; - cin >> age1 >>age2 >>age3; - if(age1 > age2){ - if(age3 > age1){ - cout << "Oldest age: " <age3) - cout << "Youngest age: " < age2){ - cout << "Oldest age: " < age3) - cout << "Youngest age: " < -using namespace std; - -int main() -{ - int age; - char sex, maritalstatus; - cin >> age >> sex >> maritalstatus; - if(sex=='F' && (age>=20 && age<=60)) - cout << "Urban areas only"; - else if(sex='M' && age>=20 && age<40) - cout <<"Work anywhere"; - else if(sex='M' && age>=40 && age<=60) - cout <<"Urban areas only"; - else - cout<<"Error"; - return 0; -} \ No newline at end of file diff --git a/AnkitaDam/IfElse/reversenumber.txt b/AnkitaDam/IfElse/reversenumber.txt deleted file mode 100644 index d175387..0000000 --- a/AnkitaDam/IfElse/reversenumber.txt +++ /dev/null @@ -1,15 +0,0 @@ -#include -using namespace std; - -int main() -{ - int number,d,revnum=0; - cin >> number; - while(number!=0){ - d=number%10; - number=number/10; - revnum=revnum*10 + d; - } - cout << revnum; - return 0; -} diff --git a/AnkitaDam/IfElse/totalcost.txt b/AnkitaDam/IfElse/totalcost.txt deleted file mode 100644 index fe6313c..0000000 --- a/AnkitaDam/IfElse/totalcost.txt +++ /dev/null @@ -1,16 +0,0 @@ -#include -using namespace std; - -int main() -{ - int cost,quantity,discountpercent,price; - cost=100; - discountpercent=10; - cin >> quantity; - price=cost*quantity; - if(price>1000) - cout <<"Total cost: "<< price-(discountpercent*price)/100.0; - else - cout <<"Total cost: "<< price; - return 0; -} \ No newline at end of file diff --git a/AnkitaDam/IfElse/valueofexpr.txt b/AnkitaDam/IfElse/valueofexpr.txt deleted file mode 100644 index b4bdef1..0000000 --- a/AnkitaDam/IfElse/valueofexpr.txt +++ /dev/null @@ -1,16 +0,0 @@ -#include -using namespace std; - -int main() -{ - int x,y,z; - x = 2; - y = 5; - z = 0; - cout<<"x == 2 gives value: "<< (x == 2)<= 5 gives value: " <<((x != 5) && (y >= 5))<< endl; - cout<<"z != 0 || x == 2 gives value: "<<((z != 0) || (x == 2)) < -using namespace std; - -int main() -{ - char ch='a'; - while(ch<='z'){ - cout< -using namespace std; - -int main() -{ - int i=1; - while(i<=100){ - if(i%2==0) - cout << i < -using namespace std; - -int main() -{ - int n,k,r; - cin >> n; - r=n%10; - while(n!=0){ - k=n%10; - n=n/10; - } - cout< -using namespace std; - -int main() -{ - int n,i=1; - cin >> n; - while(i<=10){ - cout< -using namespace std; - -int main() -{ - int n,d=0; - cin >> n; - while(n!=0){ - n=n/10; - d=d+1; - } - cout< -using namespace std; - -int main() -{ - int n,i; - cin >> n; - i=n; - while(i>=1){ - cout< -using namespace std; - -int main() -{ - int i=1; - while(i<=100){ - if(i%2!=0) - cout << i < -using namespace std; - -int main() -{ - int n,i=1; - cin >> n; - while(i<=n){ - cout< -#include -using namespace std; - -int main() -{ - int n,product=1; - cin >> n; - while(n!=0){ - product*=n%10; - n=n/10; - } - cout< -using namespace std; - -int main() -{ - int n,sum,i=1; - cin >> n; - while(i<=n){ - sum=sum+i; - i++; - } - cout< -using namespace std; - -int main() -{ - int n,sum,i=1; - cin >> n; - while(i<=n){ - if(i%2==0) - sum=sum+i; - i++; - } - cout< -using namespace std; - -int main() -{ - int n,sum,i=1; - cin >> n; - while(i<=n){ - if(i%2!=0) - sum=sum+i; - i++; - } - cout< -#include -using namespace std; - -int main() -{ - int n,sum=0; - cin >> n; - while(n!=0){ - sum+=n%10; - n=n/10; - } - cout< -using namespace std; - -int main() -{ - int n,k,r; - cin >> n; - r=n%10; - while(n!=0){ - k=n%10; - n=n/10; - } - cout< -#include -using namespace std; - -int main() -{ - int n,k,r,a,d=0; - cin >> n; - r=n%10; - a=n; - while(n!=0){ - k=n%10; - n=n/10; - d++; - } - a=a-k*pow(10,d-1); - a=a+r*pow(10,d-1); - a=a-r*1; - a=a+k*1; - cout<=1) - { - System.out.print(n +"\t"); - n--; - } - } - -} diff --git a/Arnav Sharma/Assignment-0/Loops/odd_no.java b/Arnav Sharma/Assignment-0/Loops/odd_no.java deleted file mode 100644 index 48dde16..0000000 --- a/Arnav Sharma/Assignment-0/Loops/odd_no.java +++ /dev/null @@ -1,15 +0,0 @@ -public class odd_no { - public static void main(String args[]) - { - int number=100; - System.out.print("Even numbers from 1 to "+number+": "); - for (int i=1; i<=number; i++) - { - - if (i%2!=0) - { - System.out.print(i + " "); - } - } - } -} diff --git a/Arnav Sharma/Assignment-0/Loops/sum.java b/Arnav Sharma/Assignment-0/Loops/sum.java deleted file mode 100644 index 5e31fc3..0000000 --- a/Arnav Sharma/Assignment-0/Loops/sum.java +++ /dev/null @@ -1,11 +0,0 @@ -public class sum { - public static void main(String[] args) - { - int i, num = 10, sum = 0; - for(i = 1; i <= num; ++i) - { - sum = sum + i; - } - System.out.println("Sum of First 10 Natural Numbers is = " + sum); - } -} diff --git a/Arnav Sharma/Assignment-0/Loops/sum_even.java b/Arnav Sharma/Assignment-0/Loops/sum_even.java deleted file mode 100644 index a2b43b1..0000000 --- a/Arnav Sharma/Assignment-0/Loops/sum_even.java +++ /dev/null @@ -1,12 +0,0 @@ -public class sum_even { - public static void main(String[] args) { - int sum = 0; - for (int i = 1; i <= 10; i++) { - if (i % 2 == 0) { - sum = sum + i; - } - } - System.out.println("Sum of all even from 1 to 10 is: " + sum); - } - -} \ No newline at end of file diff --git a/Arnav Sharma/Assignment-0/Loops/sum_odd.java b/Arnav Sharma/Assignment-0/Loops/sum_odd.java deleted file mode 100644 index 41d254e..0000000 --- a/Arnav Sharma/Assignment-0/Loops/sum_odd.java +++ /dev/null @@ -1,12 +0,0 @@ -public class sum_odd { - public static void main(String[] args) { - int sum = 0; - for (int i = 1; i <= 10; i++) { - if (i % 2 != 0) { - sum = sum + i; - } - } - System.out.println("Sum of all odd from 1 to 10 is: " + sum); - } - -} \ No newline at end of file diff --git a/Arnav Sharma/Assignment-0/if-else/absolute.java b/Arnav Sharma/Assignment-0/if-else/absolute.java deleted file mode 100644 index 6ad5fa7..0000000 --- a/Arnav Sharma/Assignment-0/if-else/absolute.java +++ /dev/null @@ -1,18 +0,0 @@ -public class absolute { - static void findAbsolute(int N) - { - if (N < 0) - { - N = (-1) * N; - } - - System.out.printf("%d ", N); - } - - public static void main(String[] args) - { - - int N = -12; - findAbsolute(N); - } -} diff --git a/Arnav Sharma/Assignment-0/if-else/age.java b/Arnav Sharma/Assignment-0/if-else/age.java deleted file mode 100644 index 4b0129a..0000000 --- a/Arnav Sharma/Assignment-0/if-else/age.java +++ /dev/null @@ -1,51 +0,0 @@ -import java.util.Scanner; - -public class age { - public static void main(String[] args) { - - Scanner in = new Scanner(System.in); - System.out.println("Program to find oldest and youngest of three people"); - - System.out.println("Enter the first age"); - int first = in.nextInt(); - System.out.println("Enter the second age"); - int second = in.nextInt(); - System.out.println("Enter the third age"); - int third = in.nextInt(); - - int largest = largest(first, second, third); - int smallest = smallest(first, second, third); - - System.out.printf("oldest: %d", largest); - System.out.printf("youngest: %d", smallest); - - in.close(); - } - - - public static int largest(int first, int second, int third) { - int max = first; - if (second > max) { - max = second; - } - - if (third > max) { - max = third; - } - - return max; - } - - public static int smallest(int first, int second, int third) { - int min = first; - if (second < min) { - min = second; - } - - if (third < min) { - min = third; - } - - return min; - } -} diff --git a/Arnav Sharma/Assignment-0/if-else/alphabet.java b/Arnav Sharma/Assignment-0/if-else/alphabet.java deleted file mode 100644 index b192690..0000000 --- a/Arnav Sharma/Assignment-0/if-else/alphabet.java +++ /dev/null @@ -1,20 +0,0 @@ -import java.util.Scanner; - -public class alphabet{ - public static void main(String args[]){ - char ch; - Scanner sc=new Scanner(System.in); - System.out.println("Enter the character "); - ch=sc.next().charAt(0); - if(ch>='A' && ch<='Z'){ - System.out.println(ch+" is an upper case letter "); - } - else if(ch>='a' && ch<='z'){ - System.out.println(ch+" is a lower case letter "); - } - else{ - System.out.println(ch+" is not an Alphabet "); - } - sc.close(); - } -} \ No newline at end of file diff --git a/Arnav Sharma/Assignment-0/if-else/attendance.java b/Arnav Sharma/Assignment-0/if-else/attendance.java deleted file mode 100644 index ca4d929..0000000 --- a/Arnav Sharma/Assignment-0/if-else/attendance.java +++ /dev/null @@ -1,21 +0,0 @@ -import java.util.Scanner; - -public class attendance { - public static void main(String args[]) - { - Scanner sc=new Scanner(System.in); - System.out.println("no of classes held"); - int x=sc.nextInt(); - System.out.println("no of classes attend"); - int y=sc.nextInt(); - float pf; - pf=((y*100)/x); - System.out.println(pf); - if(pf>=75) - System.out.println("eligible:"+ pf); - else - System.out.println(" not eligible:"+ pf); - - sc.close(); - } - } diff --git a/Arnav Sharma/Assignment-0/if-else/bonus.java b/Arnav Sharma/Assignment-0/if-else/bonus.java deleted file mode 100644 index e1dafe3..0000000 --- a/Arnav Sharma/Assignment-0/if-else/bonus.java +++ /dev/null @@ -1,20 +0,0 @@ -// A company decided to give bonus of 5% to employee if his/her year of service is more than 5 years. -// Ask user for their salary and year of service and print the net bonus amount. - -import java.util.Scanner; - -public class bonus{ - public static void main(String[] args) - { - Scanner sc = new Scanner(System.in); - System.out.print("Enter your salary "); - int salary = sc.nextInt(); - System.out.print("Enter years of service : "); - int years = sc.nextInt(); - if(years > 5) - System.out.println("your bonus is "+0.05*salary+" total salary " +(salary+(0.05*salary))); - else - System.out.println("no bonus"); - sc.close(); - } -} \ No newline at end of file diff --git a/Arnav Sharma/Assignment-0/if-else/discount.java b/Arnav Sharma/Assignment-0/if-else/discount.java deleted file mode 100644 index e290a62..0000000 --- a/Arnav Sharma/Assignment-0/if-else/discount.java +++ /dev/null @@ -1,21 +0,0 @@ -// A shop will give discount of 10% if the cost of purchased quantity is more than 1000. -// Ask user for quantity -// Suppose, one unit will cost 100. -// Judge and print total cost for user. -import java.util.Scanner; - -public class discount { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - System.out.print("Enter quantity : "); - int q = sc.nextInt(); - - if ((q * 100) > 1000) { - System.out.println("discount "+(.1*q*100)+"total cost "+(q*100-(.1*q*100))); - } - else { - System.out.println("no discount"); - } - sc.close(); - } -} \ No newline at end of file diff --git a/Arnav Sharma/Assignment-0/if-else/employee.java b/Arnav Sharma/Assignment-0/if-else/employee.java deleted file mode 100644 index e8941c3..0000000 --- a/Arnav Sharma/Assignment-0/if-else/employee.java +++ /dev/null @@ -1,37 +0,0 @@ -import java.util.Scanner; - -public class employee { - public static void main (String[] args) { - - Scanner sc = new Scanner (System.in); - - - System.out.println("Enter age"); - int age = sc.nextInt(); - - System.out.println("Enter sex: M/F"); - int sex = sc.next().charAt(0); - - System.out.println("Are you married? Y/N"); - int married = sc.next().charAt(0); - - if(sex == 'F') { - System.out.println("You will work only in urban areas"); - } - - if(sex == 'M') { - if((age >= 20) && (age < 40)) { - System.out.println("You may work anywhere"); - } - else if((age >= 40) && (age < 60)) { - System.out.println("You will work only in urban areas"); - } - else { - System.out.println("ERROR"); - } - sc.close(); - - } - } - } - diff --git a/Arnav Sharma/Assignment-0/if-else/exp.java b/Arnav Sharma/Assignment-0/if-else/exp.java deleted file mode 100644 index 29a74c8..0000000 --- a/Arnav Sharma/Assignment-0/if-else/exp.java +++ /dev/null @@ -1,13 +0,0 @@ -public class exp { - public static void main(String[] args) { - int x = 2; - int y = 5; - int z = 0; - System.out.println(x == 2); - System.out.println(x != 5); - System.out.println(x != 5 && y >= 5); - System.out.println(z != 0 || x == 2); - System.out.println(!(y < 10)); - - } -} diff --git a/Arnav Sharma/Assignment-0/if-else/grade.java b/Arnav Sharma/Assignment-0/if-else/grade.java deleted file mode 100644 index 79dd77b..0000000 --- a/Arnav Sharma/Assignment-0/if-else/grade.java +++ /dev/null @@ -1,33 +0,0 @@ -// grading system -import java.util.Scanner; - -public class grade { - - public static void main(String[] args){ - Scanner s = new Scanner(System.in); - System.out.println("Enter your marks"); - int x = s.nextInt(); - if(x<25){ - System.out.println("F"); - } - else if((x>=25)&&(x<45)){ - System.out.println("E"); - } - else if((x>=45)&&(x<50)){ - System.out.println("D"); - } - else if((x>=50)&&(x<60)){ - System.out.println("C"); - } - else if((x>=60)&&(x<80)){ - System.out.println("B"); - } - else if((x>=80)&&(x<=100)){ - System.out.println("A"); - } - else{ - System.out.println("Not correct marks"); - } - s.close(); - } - } diff --git a/Arnav Sharma/Assignment-0/if-else/greatest.java b/Arnav Sharma/Assignment-0/if-else/greatest.java deleted file mode 100644 index 7aec60e..0000000 --- a/Arnav Sharma/Assignment-0/if-else/greatest.java +++ /dev/null @@ -1,21 +0,0 @@ -// Take two int values from user and print greatest among them. - -import java.util.Scanner; - -public class greatest{ - public static void main(String[] args) - { - Scanner sc = new Scanner(System.in); - System.out.print("Enter the first number : "); - int first = sc.nextInt(); - System.out.print("Enter the second number : "); - int second = sc.nextInt(); - if(first > second) - System.out.println(first+" is greater than "+second); - else if(second > first) - System.out.println(second+" is greater than "+first); - else - System.out.println("Both numbers are Equal"); - sc.close(); - } -} \ No newline at end of file diff --git a/Arnav Sharma/Assignment-0/if-else/leap_year.java b/Arnav Sharma/Assignment-0/if-else/leap_year.java deleted file mode 100644 index b2278e1..0000000 --- a/Arnav Sharma/Assignment-0/if-else/leap_year.java +++ /dev/null @@ -1,36 +0,0 @@ -import java.util.Scanner; - -public class leap_year { - - public static void main(String[] args) { - - int year; - Scanner sc = new Scanner(System.in); - System.out.println("Enter any Year:"); - year = sc.nextInt(); - sc.close(); - boolean isLeap = false; - - if(year % 4 == 0) - { - if( year % 100 == 0) - { - if ( year % 400 == 0) - isLeap = true; - else - isLeap = false; - } - else - isLeap = true; - } - else { - isLeap = false; - } - - if(isLeap==true) - System.out.println(year + " is a Leap Year."); - else - System.out.println(year + " is not a Leap Year."); - } - } - diff --git a/Arnav Sharma/Assignment-0/if-else/medical.java b/Arnav Sharma/Assignment-0/if-else/medical.java deleted file mode 100644 index c6c4951..0000000 --- a/Arnav Sharma/Assignment-0/if-else/medical.java +++ /dev/null @@ -1,31 +0,0 @@ -import java.util.Scanner; - -public class medical { - public static void main(String args[]) - { - Scanner sc=new Scanner(System.in); - System.out.println("no of classes held"); - int x= sc.nextInt(); - System.out.println("no of classes attend"); - int y= sc.nextInt(); - float pf; - pf=((y*100)/x); - - System.out.println("Medical cause, Y or N:"); - char c = sc.next().charAt(0); - - System.out.println(pf); - - if(c == 'Y') { - System.out.println("eligible"); - } - else if (pf>=75) { - System.out.println("eligible:"+ pf); - } - else { - System.out.println(" not eligible:"+ pf); - } - sc.close(); - - } -} diff --git a/Arnav Sharma/Assignment-0/if-else/reverse.java b/Arnav Sharma/Assignment-0/if-else/reverse.java deleted file mode 100644 index ca1f202..0000000 --- a/Arnav Sharma/Assignment-0/if-else/reverse.java +++ /dev/null @@ -1,30 +0,0 @@ -import java.util.Scanner; - -public class reverse { - - public static void main(String[] args) { - - Scanner s = new Scanner(System.in); - - System.out.println("Enter number"); - - int x = s.nextInt (); - - int first_digit = x%10; - - int second_digit = (x/10) %10; - - int third_digit = (x/100) %10; - - int fourth_digit = (x/1000) %10; - - int new_number= (first_digit*1000)+(second_digit*100)+(third_digit*10)+(fourth_digit*1); - - System.out.println(new_number); - - s.close(); - - } - - } - diff --git a/Arnav Sharma/Assignment-0/if-else/square.java b/Arnav Sharma/Assignment-0/if-else/square.java deleted file mode 100644 index 891b8ac..0000000 --- a/Arnav Sharma/Assignment-0/if-else/square.java +++ /dev/null @@ -1,19 +0,0 @@ -// Take values of length and breadth of a rectangle from user and check if it is square or not. - -import java.util.Scanner; - -public class square{ - public static void main(String[] args) - { - Scanner sc = new Scanner(System.in); - System.out.print("Enter the length : "); - int l = sc.nextInt(); - System.out.print("Enter the breadth : "); - int b = sc.nextInt(); - if(l == b) - System.out.println("it's a square"); - else - System.out.println("not a square"); - sc.close(); - } -} diff --git a/Arnav Sharma/arnav.txt b/Arnav Sharma/arnav.txt deleted file mode 100644 index e3b8cb4..0000000 --- a/Arnav Sharma/arnav.txt +++ /dev/null @@ -1 +0,0 @@ -Dsa-bootcamp diff --git a/Arya Chakraborty/Loops/ASCII.cpp b/Arya Chakraborty/Loops/ASCII.cpp deleted file mode 100644 index ca48c6d..0000000 --- a/Arya Chakraborty/Loops/ASCII.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -using namespace std; -int main() -{ - for (int i = 32; i <= 126; i++) - { - cout << "ASCII value of character " << i << " = " << (char)i << endl; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/HCF.cpp b/Arya Chakraborty/Loops/HCF.cpp deleted file mode 100644 index d8107c0..0000000 --- a/Arya Chakraborty/Loops/HCF.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -using namespace std; -int main() -{ - int num1, num2, min, hcf = 1; - cin >> num1 >> num2; - min = (num1 < num2) ? num1 : num2; - for (int i = 1; i <= min; i++) - { - if (num1 % i == 0 && num2 % i == 0) - hcf = i; - } - cout << hcf; - return 0; -} diff --git a/Arya Chakraborty/Loops/LCM.cpp b/Arya Chakraborty/Loops/LCM.cpp deleted file mode 100644 index 5427a08..0000000 --- a/Arya Chakraborty/Loops/LCM.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -using namespace std; -int main() -{ - int num1, num2, min, hcf = 1; - cin >> num1 >> num2; - min = (num1 < num2) ? num1 : num2; - for (int i = 1; i <= min; i++) - { - if (num1 % i == 0 && num2 % i == 0) - hcf = i; - } - int lcm = num1 * num2 / hcf; - cout << lcm; - return 0; -} diff --git a/Arya Chakraborty/Loops/alphabets.cpp b/Arya Chakraborty/Loops/alphabets.cpp deleted file mode 100644 index 5835f87..0000000 --- a/Arya Chakraborty/Loops/alphabets.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -using namespace std; - -int main() -{ - char c='a'; - while(c<='z'){ - cout< -using namespace std; -int no_digits(int n) -{ - int c = 0; - while (n) - { - c++; - n /= 10; - } - return c; -} -int isArmstrong(int n) -{ - int copy = n, s = 0; - while (n) - { - int d = n % 10; - s += pow(d, no_digits(copy)); - n /= 10; - } - if (s == copy) - return 1; - else - return 0; -} -int main() -{ - int n; - cin >> n; - if (n > 0) - { - for (int i = 1; i <= n; i++) - { - if ((isArmstrong(i) == 1)) - cout << i << " "; - } - } - else - cout << "invalid"; - return 0; -} diff --git a/Arya Chakraborty/Loops/check_armstrong.cpp b/Arya Chakraborty/Loops/check_armstrong.cpp deleted file mode 100644 index 7ca7506..0000000 --- a/Arya Chakraborty/Loops/check_armstrong.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include -using namespace std; -int no_digits(int n) -{ - int c = 0; - while (n) - { - c++; - n /= 10; - } - return c; -} -int isArmstrong(int n) -{ - int copy = n, s = 0; - while (n) - { - int d = n % 10; - s += pow(d, no_digits(copy)); - n /= 10; - } - if (s == copy) - return 1; - else - return 0; -} -int main() -{ - int n; - cin >> n; - if (n > 0) - { - if (isArmstrong(n) == 1) - cout << "yes"; - else - cout << "no"; - } - else - cout << "invalid"; - return 0; -} diff --git a/Arya Chakraborty/Loops/check_prime.cpp b/Arya Chakraborty/Loops/check_prime.cpp deleted file mode 100644 index ce37f67..0000000 --- a/Arya Chakraborty/Loops/check_prime.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -using namespace std; -int isPrime(int n) -{ - int c = 0; - for (int i = 1; i <= n; i++) - { - if (n % i == 0) - c++; - } - if (c == 2) - return 1; - else - return 0; -} -int main() -{ - int n; - cin >> n; - if (n > 0) - { - if (isPrime(n) == 1) - cout << "yes"; - else - cout << "no"; - } - else - cout << "invalid"; - return 0; -} diff --git a/Arya Chakraborty/Loops/even_till_100.cpp b/Arya Chakraborty/Loops/even_till_100.cpp deleted file mode 100644 index 87bd525..0000000 --- a/Arya Chakraborty/Loops/even_till_100.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int c = 1; - while (c <= 100) - { - if (c % 2 == 0) - cout << c << " "; - c++; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/factorial.cpp b/Arya Chakraborty/Loops/factorial.cpp deleted file mode 100644 index b8a4012..0000000 --- a/Arya Chakraborty/Loops/factorial.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -using namespace std; -int main() -{ - int n, f = 1; - cin >> n; - for (int i = 1; i <= n; i++) - { - f *= i; - } - cout << f; - return 0; -} diff --git a/Arya Chakraborty/Loops/factors.cpp b/Arya Chakraborty/Loops/factors.cpp deleted file mode 100644 index 5648eca..0000000 --- a/Arya Chakraborty/Loops/factors.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -using namespace std; -int main() -{ - int n; - cin >> n; - for (int i = 1; i <= n; i++) - { - if (n % i == 0) - cout << i << " "; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/first_last_digit.cpp b/Arya Chakraborty/Loops/first_last_digit.cpp deleted file mode 100644 index 19ac41c..0000000 --- a/Arya Chakraborty/Loops/first_last_digit.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int n; - cin>>n; - if(n==0) cout<<"0 0"<=10) n/=10; - int first_digit=n; - cout< -using namespace std; -int main() -{ - int n, d0 = 0, d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0, d7 = 0, d8 = 0, d9 = 0; - cin >> n; - while (n) - { - int d = n % 10; - if (d == 0) - d0++; - else if (d == 1) - d1++; - else if (d == 2) - d2++; - else if (d == 3) - d3++; - else if (d == 4) - d4++; - else if (d == 5) - d5++; - else if (d == 6) - d6++; - else if (d == 7) - d7++; - else if (d == 8) - d8++; - else if (d == 9) - d9++; - n /= 10; - } - cout << "freuency of 0 = " << d0 << endl; - cout << "freuency of 1 = " << d1 << endl; - cout << "freuency of 2 = " << d2 << endl; - cout << "freuency of 3 = " << d3 << endl; - cout << "freuency of 4 = " << d4 << endl; - cout << "freuency of 5 = " << d5 << endl; - cout << "freuency of 6 = " << d6 << endl; - cout << "freuency of 7 = " << d7 << endl; - cout << "freuency of 8 = " << d8 << endl; - cout << "freuency of 9 = " << d9 << endl; - return 0; -} diff --git a/Arya Chakraborty/Loops/multiplication_table.cpp b/Arya Chakraborty/Loops/multiplication_table.cpp deleted file mode 100644 index fbc2e20..0000000 --- a/Arya Chakraborty/Loops/multiplication_table.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int n; - cin >> n; - for (int i = 1; i <= 10; i++) - { - cout << n << " * " << i << " = " << (n * i) << endl; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/n_to_one.cpp b/Arya Chakraborty/Loops/n_to_one.cpp deleted file mode 100644 index 3988166..0000000 --- a/Arya Chakraborty/Loops/n_to_one.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int n; - cin>>n; - while(n>0){ - cout< - -using namespace std; - -int main() -{ - int n,d=0; - cin>>n; - if(n==0) cout<<"number of digits = 1"< - -using namespace std; - -int main() -{ - int c = 1; - while (c <= 100) - { - if (c % 2 != 0) - cout << c << " "; - c++; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/one_to_n.cpp b/Arya Chakraborty/Loops/one_to_n.cpp deleted file mode 100644 index 66e845a..0000000 --- a/Arya Chakraborty/Loops/one_to_n.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int n,i=1; - cin>>n; - while(i<=n){ - cout< -using namespace std; -int main() -{ - int n; - cin >> n; - if (n == 0) - cout << "yes" << endl; - else - { - int copy = n; - int rev = 0; - while (n) - { - int d = n % 10; - rev = rev * 10 + d; - n /= 10; - } - if (rev == copy) - cout << "yes"; - else - cout << "no"; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/power_using_loop.cpp b/Arya Chakraborty/Loops/power_using_loop.cpp deleted file mode 100644 index 0554af1..0000000 --- a/Arya Chakraborty/Loops/power_using_loop.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -using namespace std; -int main() -{ - double a, b; - double power = 1.0; - cin >> a >> b; - if (a == 0) - cout << "0"; - else - { - if (b > 0) - { - for (int i = 1; i <= b; i++) - { - power *= a; - } - } - else if (b < 0) - { - for (int i = 1; i <= abs(b); i++) - { - power *= 1 / a; - } - } - else - power = 1; - cout << power; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/prime_factor.cpp b/Arya Chakraborty/Loops/prime_factor.cpp deleted file mode 100644 index 4aa9b46..0000000 --- a/Arya Chakraborty/Loops/prime_factor.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -using namespace std; -int isPrime(int n) -{ - int c = 0; - for (int i = 1; i <= n; i++) - { - if (n % i == 0) - c++; - } - if (c == 2) - return 1; - else - return 0; -} -int main() -{ - int n; - cin >> n; - if (n > 0) - { - for (int i = 1; i <= n; i++) - { - if ((isPrime(i) == 1) && (n % i == 0)) - cout << i << " "; - } - } - else - cout << "invalid"; - return 0; -} diff --git a/Arya Chakraborty/Loops/prime_till_n.cpp b/Arya Chakraborty/Loops/prime_till_n.cpp deleted file mode 100644 index bf792ce..0000000 --- a/Arya Chakraborty/Loops/prime_till_n.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -using namespace std; -int isPrime(int n) -{ - int c = 0; - for (int i = 1; i <= n; i++) - { - if (n % i == 0) - c++; - } - if (c == 2) - return 1; - else - return 0; -} -int main() -{ - int n; - cin >> n; - if (n > 0) - { - for (int i = 1; i <= n; i++) - { - if (isPrime(i) == 1) - cout << i << " "; - } - } - else - cout << "invalid"; - return 0; -} diff --git a/Arya Chakraborty/Loops/product_of_digits.cpp b/Arya Chakraborty/Loops/product_of_digits.cpp deleted file mode 100644 index 273cc2a..0000000 --- a/Arya Chakraborty/Loops/product_of_digits.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -using namespace std; -int main() -{ - int n; - cin >> n; - if (n == 0) - cout << "0" << endl; - else - { - int p = 1; - while (n) - { - int d = n % 10; - p *= d; - n /= 10; - } - cout << p; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/reverse.cpp b/Arya Chakraborty/Loops/reverse.cpp deleted file mode 100644 index eb62984..0000000 --- a/Arya Chakraborty/Loops/reverse.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -using namespace std; -int main() -{ - int n; - cin >> n; - if (n == 0) - cout << "0" << endl; - else - { - int rev = 0; - while (n) - { - int d = n % 10; - rev = rev * 10 + d; - n /= 10; - } - cout << rev; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/sum_even_till_n.cpp b/Arya Chakraborty/Loops/sum_even_till_n.cpp deleted file mode 100644 index 79af796..0000000 --- a/Arya Chakraborty/Loops/sum_even_till_n.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int c, i = 1, sum = 0; - cin >> c; - if (c < 1) - cout << "invalid number"; - else - { - while (i <= c) - { - if (i % 2 == 0) - sum += i; - i++; - } - cout << sum; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/sum_first_last_digit.cpp b/Arya Chakraborty/Loops/sum_first_last_digit.cpp deleted file mode 100644 index 53999ef..0000000 --- a/Arya Chakraborty/Loops/sum_first_last_digit.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int n; - cin>>n; - if(n==0) cout<<"0"<=10) n/=10; - int first_digit=n; - cout< - -using namespace std; - -int main() -{ - int c, i = 1, sum = 0; - cin >> c; - if (c < 1) - cout << "invalid number"; - else - { - while (i <= c) - { - if (i % 2 != 0) - sum += i; - i++; - } - cout << sum; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/sum_of_digits.cpp b/Arya Chakraborty/Loops/sum_of_digits.cpp deleted file mode 100644 index 71158a2..0000000 --- a/Arya Chakraborty/Loops/sum_of_digits.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -using namespace std; -int power(int a, int b) -{ - double x = a; - double y = b; - return (int)pow(x, y); -} -int main() -{ - int n; - cin >> n; - if (n == 0) - cout << "0" << endl; - else - { - int s = 0; - while (n) - { - int d = n % 10; - s += d; - n /= 10; - } - cout << s; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/sum_prime.cpp b/Arya Chakraborty/Loops/sum_prime.cpp deleted file mode 100644 index 8f3ae9b..0000000 --- a/Arya Chakraborty/Loops/sum_prime.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -using namespace std; -int isPrime(int n) -{ - int c = 0; - for (int i = 1; i <= n; i++) - { - if (n % i == 0) - c++; - } - if (c == 2) - return 1; - else - return 0; -} -int main() -{ - int n, s = 0; - cin >> n; - if (n > 0) - { - for (int i = 1; i <= n; i++) - { - if (isPrime(i) == 1) - s += i; - } - cout << s; - } - else - cout << "invalid"; - return 0; -} diff --git a/Arya Chakraborty/Loops/sum_till_n.cpp b/Arya Chakraborty/Loops/sum_till_n.cpp deleted file mode 100644 index 8b15057..0000000 --- a/Arya Chakraborty/Loops/sum_till_n.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int c, i = 1, sum = 0; - cin >> c; - if (c < 1) - cout << "invalid number"; - else - { - while (i <= c) - { - sum += i; - i++; - } - cout << sum; - } - return 0; -} diff --git a/Arya Chakraborty/Loops/swap_first_last_digits.cpp b/Arya Chakraborty/Loops/swap_first_last_digits.cpp deleted file mode 100644 index 0173a4f..0000000 --- a/Arya Chakraborty/Loops/swap_first_last_digits.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -using namespace std; -int power(int a, int b) -{ - double x = a; - double y = b; - return (int)pow(x, y); -} -int main() -{ - int n, c = 0; - cin >> n; - int copy = n; - if (n == 0) - cout << "0" << endl; - else - { - int last_digit = n % 10; - while (copy >= 10) - { - copy /= 10; - c++; - } - int first_digit = copy; - int ans = (n % (power(10, c))) / 10; - ans = last_digit * power(10, c - 1) + ans; - ans = ans * 10 + first_digit; - cout << ans; - } - return 0; -} diff --git a/Arya Chakraborty/if-else questions/absolute.cpp b/Arya Chakraborty/if-else questions/absolute.cpp deleted file mode 100644 index 56dfb51..0000000 --- a/Arya Chakraborty/if-else questions/absolute.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int n; - cin >> n; - if (n > 0) - { - std::cout << n << std::endl; - } - else if (n < 0) - { - std::cout << -n << std::endl; - } - else - std::cout << 0 << std::endl; - return 0; -} diff --git a/Arya Chakraborty/if-else questions/attendance.cpp b/Arya Chakraborty/if-else questions/attendance.cpp deleted file mode 100644 index 48f0228..0000000 --- a/Arya Chakraborty/if-else questions/attendance.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -using namespace std; - -int main() -{ - double classes_held,classes_attended; - cin>>classes_held>>classes_attended; - double attendance=(classes_attended/classes_held)*100; - std::cout << "attendance = " << attendance << "%" << std::endl; - if(attendance<75.0){ - std::cout << "not allowed to sit in exam" << std::endl; - } - else std::cout << "allowed to sit in exam" << std::endl; - return 0; -} diff --git a/Arya Chakraborty/if-else questions/attendance_with_medical_cause.cpp b/Arya Chakraborty/if-else questions/attendance_with_medical_cause.cpp deleted file mode 100644 index 2807aef..0000000 --- a/Arya Chakraborty/if-else questions/attendance_with_medical_cause.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -using namespace std; - -int main() -{ - double classes_held,classes_attended; - char medical_cause; - cin>>classes_held>>classes_attended>>medical_cause; - double attendance=(classes_attended/classes_held)*100; - std::cout << "attendance = " << attendance << "%" << std::endl; - if(attendance<75.0){ - if(medical_cause=='Y') std::cout << "allowed to sit in exam" << std::endl; - else std::cout << "not allowed to sit in exam" << std::endl; - } - else std::cout << "allowed to sit in exam" << std::endl; - return 0; -} diff --git a/Arya Chakraborty/if-else questions/discount.cpp b/Arya Chakraborty/if-else questions/discount.cpp deleted file mode 100644 index 61d261c..0000000 --- a/Arya Chakraborty/if-else questions/discount.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -using namespace std; - -int main() -{ - double purchase_quantity; - cin >> purchase_quantity; - if ((purchase_quantity * 100) > 1000) - { - std::cout << "total cost = " << ((purchase_quantity * 100) - (0.1 * purchase_quantity * 100)) << std::endl; - } - else - std::cout << "no discount" << std::endl; - return 0; -} diff --git a/Arya Chakraborty/if-else questions/employee.cpp b/Arya Chakraborty/if-else questions/employee.cpp deleted file mode 100644 index dd839a9..0000000 --- a/Arya Chakraborty/if-else questions/employee.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int age; - char sex,married; - cin>>age>>sex>>married; - if(sex=='F'){ - std::cout << "urban area" << std::endl; - } - else if(sex=='M' && (age>20 && age<40)){ - std::cout << "anywhere" << std::endl; - } - else if(sex=='M' && (age>=40 && age<60)){ - std::cout << "urban area" << std::endl; - } - else std::cout << "ERROR" << std::endl; - return 0; -} diff --git a/Arya Chakraborty/if-else questions/grade_card.cpp b/Arya Chakraborty/if-else questions/grade_card.cpp deleted file mode 100644 index bb1e16e..0000000 --- a/Arya Chakraborty/if-else questions/grade_card.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int marks; - cin >> marks; - if (marks < 25) - { - std::cout << "F" << std::endl; - } - else if (marks >= 25 && marks < 45) - { - std::cout << "E" << std::endl; - } - else if (marks >= 45 && marks < 50) - { - std::cout << "D" << std::endl; - } - else if (marks >= 50 && marks < 60) - { - std::cout << "C" << std::endl; - } - else if (marks >= 60 && marks <= 80) - { - std::cout << "B" << std::endl; - } - else if (marks > 80) - { - std::cout << "A" << std::endl; - } - return 0; -} diff --git a/Arya Chakraborty/if-else questions/greater_number.cpp b/Arya Chakraborty/if-else questions/greater_number.cpp deleted file mode 100644 index bec5d63..0000000 --- a/Arya Chakraborty/if-else questions/greater_number.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int a,b; - cin>>a>>b; - if(a>b) std::cout << a << std::endl; - else std::cout << b << std::endl; - return 0; -} diff --git a/Arya Chakraborty/if-else questions/is_square.cpp b/Arya Chakraborty/if-else questions/is_square.cpp deleted file mode 100644 index 2b84dac..0000000 --- a/Arya Chakraborty/if-else questions/is_square.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int length, breadth; - cin >> length >> breadth; - if (length == breadth) - std::cout << "square" << std::endl; - else - std::cout << "not a square" << std::endl; - return 0; -} diff --git a/Arya Chakraborty/if-else questions/leap_year_check.cpp b/Arya Chakraborty/if-else questions/leap_year_check.cpp deleted file mode 100644 index c549e04..0000000 --- a/Arya Chakraborty/if-else questions/leap_year_check.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int year; - cin>>year; - if(year%400==0){ - std::cout << "leap year" << std::endl; - } - else if(year%100==0){ - std::cout << "non-leap year" << std::endl; - } - else if(year%4==0){ - std::cout << "leap year" << std::endl; - } - else{ - std::cout << "non-leap year" << std::endl; - } - return 0; -} diff --git a/Arya Chakraborty/if-else questions/net_bonus.cpp b/Arya Chakraborty/if-else questions/net_bonus.cpp deleted file mode 100644 index edd1480..0000000 --- a/Arya Chakraborty/if-else questions/net_bonus.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int term; - double salary,bonus=0.0; - cin>>term; - if(term>5){ - cin>>salary; - bonus=0.05*salary; - std::cout << bonus << std::endl; - } - else - std::cout << bonus << std::endl; - return 0; -} diff --git a/Arya Chakraborty/if-else questions/oldest_youngest_age.cpp b/Arya Chakraborty/if-else questions/oldest_youngest_age.cpp deleted file mode 100644 index 99a26ad..0000000 --- a/Arya Chakraborty/if-else questions/oldest_youngest_age.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int a,b,c; - cin>>a>>b>>c; - int oldest,youngest; - if(a>b){ - if(a>c){ - oldest=a; - if(c>b) youngest=b; - else youngest=c; - } - else{ - oldest=c; - youngest=b; - } - } - else{ - if(b>c){ - oldest=b; - if(c>a) youngest=a; - else youngest=c; - } - else{ - oldest=c; - youngest=a; - } - } - std::cout << "oldest=" << oldest << std::endl; - std::cout << "youngest=" << youngest << std::endl; - //oldest=max(a,max(c,b)); - //youngest=min(a,min(c,b)); - return 0; -} diff --git a/Arya Chakraborty/if-else questions/relational_operators_check.cpp b/Arya Chakraborty/if-else questions/relational_operators_check.cpp deleted file mode 100644 index f3c786f..0000000 --- a/Arya Chakraborty/if-else questions/relational_operators_check.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int x=2; - int y=5; - int z=0; - std::cout << (x==2) << std::endl; - std::cout << (x!=5) << std::endl; - std::cout << (x!=5 && y>=5) << std::endl; - std::cout << (z!=0 || x==2) << std::endl; - std::cout << (!(y<10)) << std::endl; - return 0; -} diff --git a/Arya Chakraborty/if-else questions/reversed_number.cpp b/Arya Chakraborty/if-else questions/reversed_number.cpp deleted file mode 100644 index a130dd4..0000000 --- a/Arya Chakraborty/if-else questions/reversed_number.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int n,reversed_no=0; - cin>>n; - while(n){ - int digit=n%10; - reversed_no=reversed_no*10+digit; - n/=10; - } - std::cout << "reversed number = " << reversed_no << std::endl; - return 0; -} diff --git a/Arya Chakraborty/if-else questions/uppercase_lowercase.cpp b/Arya Chakraborty/if-else questions/uppercase_lowercase.cpp deleted file mode 100644 index d201a33..0000000 --- a/Arya Chakraborty/if-else questions/uppercase_lowercase.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -using namespace std; - -int main() -{ - char c; - cin>>c; - int x=(int)c; - if(c>=97 && c<=122){ - std::cout << "lowercase" << std::endl; - } - else if(c>=65 && c<=90){ - std::cout << "uppercase" << std::endl; - } - return 0; -} diff --git a/Bikash das/If - else/Absolute_number.cpp b/Bikash das/If - else/Absolute_number.cpp deleted file mode 100644 index 35a442b..0000000 --- a/Bikash das/If - else/Absolute_number.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -using namespace std; -int main(){ - int number; - //Enter number to find its absolute no. - cout << "Enter number " < -using namespace std; -int main(){ - int T_c_Held,t_c_attended; - //Enter the number of total class held - cout << "Enter the number of total class held" <> T_c_Held; - //Enter the number of class you attend - cout << "Enter the number of class you attend" <> t_c_attended; - float att_percen=(t_c_attended*100)/T_c_Held; - cout << "Percentage of attendance is " << att_percen < -using namespace std; -int main(){ - int age; - char sex; - char maritial_status; - //Enter age of worker - cout <<"Enter age of worker::"<>age; - //Enter SEX of worker - cout <<"Enter SEX of worker:::(IF MALE ENTER m or if female f)"<> sex; - //Enter martial status - cout <<"What is maritial status of worker?(if YES enter 'y' or if NO enter 'n'" << endl; - cin >>maritial_status; - if('sex is f') - cout <<"This worker can only work in urban areas"< -#include -using namespace std; -int t_f(int num){ - if(num==1) - cout << "True"<=5); - t_f(c); - int d=bool(z!=0 || x==2); - t_f(d); - int e=bool(!(y<10)); - t_f(e); - - -} diff --git a/Bikash das/If - else/Grade_you_get.cpp b/Bikash das/If - else/Grade_you_get.cpp deleted file mode 100644 index c62c8cb..0000000 --- a/Bikash das/If - else/Grade_you_get.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -using namespace std; -int main(){ - int mark; - //Enter the mark you get out of 100 - cout << "Enter the mark you get out of 100 " <> mark; - if(mark<25) - cout << "Grade is 'F'" << endl; - else if(mark>=25 && mark<45) - cout << "Grade is 'E'" << endl; - else if(mark>=45 && mark<50) - cout << "Grade is 'D'" << endl; - else if(mark>=55 && mark<60) - cout << "Grade is 'C'" << endl; - else if(mark>=60 && mark<80) - cout << "Grade is 'B'" << endl; - else if(mark>100) - cout << "No grade is their" << endl; - else if(mark>=80) - cout << "Grade is 'A'" << endl; -} diff --git a/Bikash das/If - else/Greatest number between two number.cpp b/Bikash das/If - else/Greatest number between two number.cpp deleted file mode 100644 index d603f8f..0000000 --- a/Bikash das/If - else/Greatest number between two number.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -using namespace std; - -int main(){ - int num1,num2; - //Enter value of num1 - cout << "Enter value of num1::" <>num1; - //Enter value of num2 - cout<<"Enter value of num2::"<>num2; - - //Greatest number checking - if(num1>num2){ - cout<< num1 <<"is greater than"< -using namespace std; -int main(){ - int year; - //Enter a year - cout << "Enter a year" <> year; - if(year%4==0){ - if(year%100==0){ - if(year%400==0) - cout << "It is a leap year" < -using namespace std; -int main(){ - int number; - //Enter a 4th digit number - cout << "Enter a 4th digit number"<>number; - int f,s,t,fh; - fh=number%10; - number=number/10; - t=number%10; - number=number/10; - s=number%10; - number=number/10; - f=number%10; - int upd_num=0; - upd_num=(fh*1000)+(t*100)+(s*10)+f; - cout <<"The reverse of "<< number<<" is "< -using namespace std; - -int main(){ - int b,totalb; - //Enter the quatity of things you purchased ,suppose one quantity charge 100 rs. - cout << "Enter the quantity of things" <> b; - //total amount you purchase - totalb=b*100; - if(totalb>1000){ - int tendis=(10*totalb)/100; - int disconb=totalb-tendis; - cout << "CONGRATULAION, you got 10% discount!!!" << "Now you have to pay " << disconb << "from" << totalb < -using namespace std; -int main(){ - char letter; - //Enter a letter - cout << "Enter a letter::::" <> letter; - int letter_num=letter; - cout << "ASCII value of this letter" << letter_num <=65 && letter_num<=90) - cout << "Entered letter is UPPER case letter" <=97 && letter_num<=122) - cout << "Entered letter is Lower case letter" < -using namespace std; -int main(){ - int T_c_Held,t_c_attended; - //Enter the number of total class held - cout << "Enter the number of total class held" <> T_c_Held; - //Enter the number of class you attend - cout << "Enter the number of class you attend" <> t_c_attended; - float att_percen=(t_c_attended*100)/T_c_Held; - cout << "Percentage of attendance is " << att_percen <>ans; - if(att_percen<75.00){ - if('ans is Y') - cout << "You can sit in Examination hall" < -using namespace std; -int age0(int age1,int age2,int age3){ - if(age1>age2 && age1>age3){ - cout << "1ST person is older" <age3){ - cout << "3RD person is younger" <age2){ - cout << "2ND person is younger" <age1 && age2>age3){ - cout << "2ND person is older" <age3){ - cout << "3RD person is younger" <age1){ - cout << "1ST person is younger" <age1 && age3>age2){ - cout << "3RD person is older" <age1){ - cout << "1ST person is younger" <age2){ - cout << "2ND person is younger" <> Aage; - cout << "Enter 2nd person age"<> Bage; - cout << "Enter 3rd person age"<> Cage; - age0(Aage,Bage,Cage); -} diff --git a/Bikash das/If - else/salarybonus.cpp b/Bikash das/If - else/salarybonus.cpp deleted file mode 100644 index 4e21b69..0000000 --- a/Bikash das/If - else/salarybonus.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -using namespace std; - -int main(){ - int salary,year; - - //Enter your total salary per annum - cout << "Enter your total salary per annum:::" <> salary; - - //Enter your year of services till now in this company - cout << "Enter your year of service till now in this company::" <> year; - - if(year>5){ - float bonus=(5*salary)/100; - float totalsalary=salary+bonus; - cout << "As you are working since " << year << " year,so you got 5% bonus with your salary,then your total salary will be " << totalsalary < -using namespace std; - -int main(){ - int length,breath; - //Enter length - cout << "Enter length:" << endl; - cin >> length; - //Enter breath - cout << "Enter breath:" << endl; - cin >> breath; - - //square or not - if(length==breath){ - cout << "This length and breath can from a Square:::" < -using namespace std; -int main(){ - long long num; - //Enter a number - cout <<"Enter a number:::"<>num; - int count=0; - for(int i=0;num>0;i++){ - count++; - num=num/10; - } - cout <<"No of digits is:::"< -using namespace std; -int main(){ - int num; - //Enter the number - cout << "Enter the number"<>num; - cout << "Even numbers are:::"< -using namespace std; -int main(){ - int num; - //Enter number whose multiplication table is required - cout <<"Enter number whose multiplication table is required::::"<>num; - int mul=0; - cout <<"Now multiplication table of "<> num; - cout << "The numbers are:::::::::::::" << endl; - int i=0; - while(i<=num){ - cout << i < -using namespace std; -int main(){ - int num; - //Enter the number - cout << "Enter the number"<>num; - cout << "Odd numbers are:::"< -using namespace std; -int main(){ - int num; - int mul=1; - //Enter the number - cout << "Enter the number"<>num; - for(int i=1;i<=num;i++){ - if(i%2==0) - mul=mul*i; - } - cout << "Product of the Even numbers:::" < -using namespace std; -int main(){ - int num; - int mul=1; - //Enter the number - cout << "Enter the number"<>num; - for(int i=1;i<=num;i++){ - if(i%2!=0) - mul=mul*i; - } - cout << "Product of the odd numbers:::" < -using namespace std; -int main(){ - int num; - //Enter a number - cout << "Enter a number::" <> num; - cout << "The numbers are:::" <=0){ - cout << i < -using namespace std; -int main(){ - int num; - int sum=0; - int i=0; - //Enter a number - cout << "Enter the number::" <> num; - while(i -using namespace std; -int main(){ - int num; - int sum=0; - //Enter the number - cout << "Enter the number"<>num; - for(int i=0;i -using namespace std; -int main(){ - int num; - int sum=0; - //Enter the number - cout << "Enter the number"<>num; - for(int i=0;i -using namespace std; -int main(){ - int a; - cout<<"Enter a number : "; - cin>>a; - if(a<0){ - cout< -using namespace std; -int main(){ - float total_classes,total_attended; - cout<<"Enter the number of classes held : "; - cin>>total_classes; - cout<<"Enter the number of classes attended : "; - cin>>total_attended; - float attendance=(total_attended/total_classes)*100; - cout<<"Your attendance percentage is "<=75){ - cout<<"You are permitted to write your exam"; - } - else{ - cout<<"You are NOT permitted to write your exam"; - } - return 0; -} \ No newline at end of file diff --git a/Everly Precia Suresh/If-Else/attendance_variation.cpp b/Everly Precia Suresh/If-Else/attendance_variation.cpp deleted file mode 100644 index ff517c5..0000000 --- a/Everly Precia Suresh/If-Else/attendance_variation.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -using namespace std; -int main(){ - float total_classes,total_attended; - cout<<"Enter the number of classes held : "; - cin>>total_classes; - cout<<"Enter the number of classes attended : "; - cin>>total_attended; - float attendance=(total_attended/total_classes)*100; - cout<<"Your attendance percentage is "<=75){ - cout<<"You are permitted to write your exam"; - } - else{ - cout<<"Is the cause of your absence because of medical issues (Y/N) ?"; - char input; - cin>>input; - if(input=='Y'||input=='y') cout<<"You are permitted to write your exam"; - else if(input=='N'||input=='n') cout<<"You are NOT permitted to write your exam"; - else cout<<"Invalid Character"; - } - return 0; -} diff --git a/Everly Precia Suresh/If-Else/bonus.cpp b/Everly Precia Suresh/If-Else/bonus.cpp deleted file mode 100644 index 90282bd..0000000 --- a/Everly Precia Suresh/If-Else/bonus.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -using namespace std; -int main(){ - int salary , years; - cout<<"Enter Salary : "; - cin>>salary; - cout<<"Enter Years of Service : "; - cin>>years; - if(years>5){ - int bonus=(salary*5)/100; - cout<<"The net bonus amount is"< -#include -using namespace std; -int main(){ - char input; - cout<<"Enter a character : "; - cin>>input; - if(isupper(input)){ - cout<<"Character is in Uppercase"; - } - else{ - cout<<"Character is in Lowercase"; - } - return 0; -} \ No newline at end of file diff --git a/Everly Precia Suresh/If-Else/cost.cpp b/Everly Precia Suresh/If-Else/cost.cpp deleted file mode 100644 index 3fd1259..0000000 --- a/Everly Precia Suresh/If-Else/cost.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -using namespace std; -int main(){ - cout<<"Enter quantities purchased : "; - int p; - cin>>p; - int original_total=p*100; - int new_total=0; - int ans=0; - if(original_total>1000){ - new_total=(original_total*10)/100; - ans=original_total-new_total; - cout<<"You got a 10% discount!"< -using namespace std; -int main(){ - int x=2,y=5,z=0; - cout<<(x==2)<= 5)< -using namespace std; -int main(){ - int mark; - cout<<"Enter your mark: "; - cin>>mark; - if(mark>=80 && mark<=100){ - cout<<"Your Grade is A"<=60 && mark<80){ - cout<<"Your Grade is B"<=50 && mark<60){ - cout<<"Your Grade is C"<=45 && mark<50){ - cout<<"Your Grade is D"<=25 && mark<45){ - cout<<"Your Grade is E"< -using namespace std; -int main(){ - int year; - cout<<"Enter a year: "; - cin>>year; - if(year%400==0){ - cout<<"Leap Year"; - } - else if(year%100==0){ - cout<<"Not Leap Year"; - } - else if(year%4==0){ - cout<<"Leap Year"; - } - else - cout<<"Not Leap Year"; - return 0; -} \ No newline at end of file diff --git a/Everly Precia Suresh/If-Else/max.cpp b/Everly Precia Suresh/If-Else/max.cpp deleted file mode 100644 index 293b315..0000000 --- a/Everly Precia Suresh/If-Else/max.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -using namespace std; -int main(){ - int a,b; - cout<<"Please enter only two distinct values!\n"; - cout<<"Enter First Number : "; - cin>>a; - cout<<"Enter Second Number : "; - cin>>b; - if(a>b) - cout< -using namespace std; -int main(){ - int a,b,c; - int max=0,min=100; - cout<<"Enter Person 1's age: "; - cin>>a; - cout<<"Enter Person 2's age: "; - cin>>b; - cout<<"Enter Person 3's age: "; - cin>>c; - if(a>b && a>c ){ - max=a; - } - if(ac && b>a){ - max=b; - } - if(ba && c>b){ - max=c; - } - if(c -using namespace std; -int main(){ - int age; - char gender; - char martial_status; - cout<<"Enter your age : "; - cin>>age; - cout<<"Enter your sex [M or F] : "; - cin>>gender; - cout<<"Enter your martial status [Y or N] : "; - cin>>martial_status; - if(gender=='F'){ - cout<<"Place of Service: Urban Areas"; - } - else if(gender=='M'&& (age>=20 && age<=40)){ - cout<<"Place of Serivce: Anywhere"; - } - else if(gender=='M'&& (age>=40 && age<=60)){ - cout<<"Place of Serivce: Urban Areas"; - } - else if(age<20 || age>60){ - cout<<"ERROR"; - } - else if(martial_status !='Y'|| martial_status!='N'){ - cout<<"Invalid Option"; - } - else{ - cout<<"Invalid Option"; - } - return 0; -} \ No newline at end of file diff --git a/Everly Precia Suresh/If-Else/reverse_number.cpp b/Everly Precia Suresh/If-Else/reverse_number.cpp deleted file mode 100644 index 9a36cad..0000000 --- a/Everly Precia Suresh/If-Else/reverse_number.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -using namespace std; -int main(){ - int n,R,rev=0; - cout<<"Enter a number : "; - cin>>n; - while(n!=0){ - R=n%10; - rev=(rev*10)+R; - n=n/10; - } - cout< -using namespace std; -int main(){ - int l,b; - cout<<"Enter Length of Rectangle :"; - cin>>l; - cout<<"Enter Breadth of Rectangle:"; - cin>>b; - if(l==b){ - cout<<"These dimensions form a square"; - } - else{ - cout<<"These dimensions don't form a square"; - } - return 0; -} \ No newline at end of file diff --git a/Everly Precia Suresh/loops/alphabets.cpp b/Everly Precia Suresh/loops/alphabets.cpp deleted file mode 100644 index 43de010..0000000 --- a/Everly Precia Suresh/loops/alphabets.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -using namespace std; -int main(){ - char x='A'; - while (x<='Z'){ - cout< -using namespace std; -int main(){ - int i=1; - while(i<=100){ - if(i%2==0){ - cout< -using namespace std; -int main(){ - cout<<"Enter a number : "; - int n,f=0; - cin>>n; - int l=n%10; - while(n!=0){ - f=n%10; - n=n/10; - } - cout<<"The First Digit is "< -using namespace std; -int main(){ - int n; - cout<<"Enter number for multiplication table : "; - cin>>n; - for(int i=1;i<=10;i++){ - cout<>N; - int i=1; - while(i<=N){ - cout< -using namespace std; -int main(){ - cout<<"Enter value for N : "; - int N; - cin>>N; - while(N>0){ - cout< -using namespace std; -int main(){ - int n,count=0; - cout<<"Enter a number: "; - cin>>n; - while(n!=0){ - - n=n/10; - count++; - } - cout<<"The number of digits in this number is "< -using namespace std; -int main(){ - int i=1; - while(i<=100){ - if(i%2!=0){ - cout< -using namespace std; -int main(){ - int n,r=0,product=1; - cout<<"Enter a number : "; - cin>>n; - while(n!=0){ - r=n%10; - n=n/10; - product*=r; - } - cout<<"The product of the digits in this number : "< -using namespace std; -int main(){ - int n,r=0,sum=0; - cout<<"Enter a number : "; - cin>>n; - while(n!=0){ - r=n%10; - n=n/10; - sum+=r; - } - cout<<"The Sum of digits in this number : "< -using namespace std; -int main(){ - int sum=0; - int N; - cout<<"Enter N Value: "; - cin>>N; - for(int i=1;i<=N;i++){ - if(i%2==0){ - sum+=i; - } - } - cout<<"Sum of all even numbers between 1 to "< -using namespace std; -int main(){ - int sum=0; - int N; - cout<<"Enter N Value: "; - cin>>N; - for(int i=1;i<=N;i++){ - sum+=i; - } - cout<<"Sum of all natural numbers between 1 to "< -using namespace std; -int main(){ - int sum=0; - int N; - cout<<"Enter N Value: "; - cin>>N; - for(int i=1;i<=N;i++){ - if(i%2!=0){ - sum+=i; - } - } - cout<<"Sum of all odd numbers between 1 to "< -using namespace std; -int main(){ - cout<<"Enter a number : "; - int n,f=0; - cin>>n; - int l=n%10; - while(n!=0){ - f=n%10; - n=n/10; - } - cout<<"The Sum of First Digit and Last Digit is "< -#include - -using namespace std; - -int main() -{ - int N, last, first, n, swap, digits = 0; - - - cout<<"Enter a Number:"; - cin>>N; - - n = N; - last = n % 10; - - - while(n>=10) - { - n /= 10; - digits++; - } - - first = n; - - - swap=last*pow(10,digits); - swap=swap+ (N% (int)pow(10,digits)); - swap=swap-last; - swap=swap+first; - cout< -using namespace std; -int main(){ - int n,c=0; - cout<<"\nEnter the Number : "; - cin>>n; - cout<<"\nNo of Digits in "< -using namespace std; -int main(){ - cout<<"\nEven Numbers between 1-100 : "; - for(int i=1;i<=100;i++){ - if(i%2==0) - cout< -using namespace std; -int main(){ - int n; - cout<<"\nEnter the Number : "; - cin>>n; - int a=n; - while(a>=10){ - a=a/10; - } - cout<<"First Digit : "< -using namespace std; -int main(){ - int n; - cout<<"\nEnter the integer : "; - cin>>n; - cout<<"\nMultiplication table of "< -using namespace std; -int main(){ - cout<<"\nOdd Numbers between 1-100 : "; - for(int i=1;i<=100;i++){ - if(i%2!=0) - cout< -using namespace std; -int main(){ - char i; - coutt<<"\nLower Case Letters : "; - for(i='a';i<='z';i++){ - cout< -using namespace std; -int main(){ - int n,r,s=1; - cout<<"\nEnter the Number : "; - cin>>n; - cout<<"\nProduct of digits of "< -Write a C program to print all natural numbers from 1 to n. - using while loop
-Write a C program to print all natural numbers in reverse (from n to 1). - using while loop
-Write a C program to print all alphabets from a to z. - using while loop
-Write a C program to print all even numbers between 1 to 100. - using while loop
-Write a C program to print all odd number between 1 to 100.
-Write a C program to find sum of all natural numbers between 1 to n.
-Write a C program to find sum of all even numbers between 1 to n.
-Write a C program to find sum of all odd numbers between 1 to n.
-Write a C program to print multiplication table of any number.
-Write a C program to count number of digits in a number.
-Write a C program to find first and last digit of a number.
-Write a C program to swap first and last digits of a number.
-Write a C program to calculate sum of digits of a number.
-Write a C program to calculate product of digits of a number.
diff --git a/Hima Rani Mathews/Loops/SumOfDigits.cpp b/Hima Rani Mathews/Loops/SumOfDigits.cpp deleted file mode 100644 index 04cc769..0000000 --- a/Hima Rani Mathews/Loops/SumOfDigits.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -using namespace std; -int main(){ - int n,r,s=0; - cout<<"\nEnter the Number : "; - cin>>n; - cout<<"\nSum of digits of "< -using namespace std; -int main(){ - int n; - cout<<"\nEnter the Number : "; - cin>>n; - int a=n; - while(a>=10){ - a=a/10; - } - cout<<"\nSum of first digit : "<>n; - cout<<"\nSum of Even nos upto "< -using namespace std; -int main(){ - int n,s=0; - cout<<"\nEnter the integer : "; - cin>>n; - cout<<"\nSum of Natural Nos upto "< -using namespace std; -int main(){ - int n,s=0; - cout<<"\nEnter the integer : "; - cin>>n; - cout<<"\nSum of Odd nos upto "< -#include -using namespace std; -int main() -{ - int n, l, f, temp, swap, c = 0; - cout<<"Enter any number:"; - cin>>n; - temp = n; - l = temp % 10; - c = (int)log10(temp); - //cout<=10) - { - temp /= 10; - } - f = temp; - swap = (l* pow(10, c) + f) + (n - (f * pow(10, c) + l)); - cout<<"Last Digit: "< -using namespace std; -int main(){ - int n; - cout<<"\nEnter the integer : "; - cin>>n; - cout<<"\nNatural Numbers upto "< -using namespace std; -int main(){ - int n; - cout<<"\nEnter the integer : "; - cin>>n; - cout<<"\nReverse of Natural Numbers from "<=1;i--){ - cout< -using namespace std; -int main(){ - int a; - cout<<"\nEnter the integer : "; - cin>>a; - if(a>0){ - cout<<"Absolute Value of "< -using namespace std; -int main(){ - float nch,nca; - cout<<"\nEnter the no. of classes held & attended : "; - cin>>nch>>nca; - float p=(nca/nch)*100; - if(p>=75){ - cout<<"The student with "< -using namespace std; -int main(){ - int u,r,tot; - cout<<"\nEnter no.of Units : "; - cin>>u; - if((u*100)>1000){ - r=0.1*u*100; - tot=u*100-r; - cout<<"Total cost = "< -using namespace std; -int main(){ - int age; - char s,mar; - cout<<"\nEnter your Age, Sex & Marital Status : "; - cin>>age>>s>>mar; - if(s=='F'||s=='f') - cout<<"Employee Works in Urban Areas"; - else if(s=='M'||s=='m') - { - if(age>=20 && age<40) - cout<<"Employee Works Anywhere"; - else if(age>=40 && age<60) - cout<<"Employee Works in Urban Areas"; - else - cout<<"ERROR"; - } -} diff --git a/Hima Rani Mathews/if-else/FindValue.cpp b/Hima Rani Mathews/if-else/FindValue.cpp deleted file mode 100644 index c6aa680..0000000 --- a/Hima Rani Mathews/if-else/FindValue.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include -using namespace std; -int main(){ - int x=2,y=5,z=0; - cout<<(x==2)<<"\n"<<(x!=5)<<"\n"<<(x!=5&&y>=5)<<"\n"<<(z!=0||x==2)<<"\n"<<(!(y<10)); -} diff --git a/Hima Rani Mathews/if-else/Grade.cpp b/Hima Rani Mathews/if-else/Grade.cpp deleted file mode 100644 index 7580dd4..0000000 --- a/Hima Rani Mathews/if-else/Grade.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -using namespace std; -int main(){ - int m; - cout<<"\nEnter the marks : "; - cin>>m; - cout<<"Marks : "<=80){ - cout<<"A"; - } - else if(m<80 && m>=60){ - cout<<"B"; - } - else if(m<60 && m>=50){ - cout<<"C"; - } - else if(m<50 && m>=45){ - cout<<"D "; - } - else if(m<45 && m>=25){ - cout<<"E "; - } - else - { - cout<<"F "; - } - -} - diff --git a/Hima Rani Mathews/if-else/LeapYear.cpp b/Hima Rani Mathews/if-else/LeapYear.cpp deleted file mode 100644 index d87d36d..0000000 --- a/Hima Rani Mathews/if-else/LeapYear.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -using namespace std; -int main(){ - int yr; - cout<<"\nEnter the year : "; - cin>>yr; - if(yr%4==0){ - if(yr%100==0){ - if(yr%400==0) - { - cout< -using namespace std; -int main(){ - float nch,nca; - char ch; - cout<<"\nEnter the no. of classes held & attended : "; - cin>>nch>>nca; - float p=(nca/nch)*100; - if(p>=75){ - cout<<"The student with "<>ch; - if(ch=='Y'||ch=='y') - cout<<"The student with "< -using namespace std; -int main(){ - int sal,yrofs,r,tot; - cout<<"\nEnter Salary and Year of service : "; - cin>>sal>>yrofs; - if(yrofs>=5){ - r=0.5*sal; - tot=sal+r; - cout<<"Net Bonus Amount = "< -using namespace std; -int main(){ - int a,b,c; - cout<<"\nEnter ages of three people : "; - cin>>a>>b>>c; - int old=(a>b)?(a>c)?a:c:(b>c)?b:c; - int young=(a -1.Take values of length and breadth of a rectangle from user and check if it is square or not.
-2.Take two int values from user and print greatest among them.
-3.A shop will give discount of 10% if the cost of purchased quantity is more than 1000. -Ask user for quantity -Suppose, one unit will cost 100. -Judge and print total cost for user.
-4.A company decided to give bonus of 5% to employee if his/her year of service is more than 5 years. -Ask user for their salary and year of service and print the net bonus amount.
-5.A school has following rules for grading system: -a. Below 25 - F -b. 25 to 45 - E -c. 45 to 50 - D -d. 50 to 60 - C -e. 60 to 80 - B -f. Above 80 - A -Ask user to enter marks and print the corresponding grade.
-6.Take input of age of 3 people by user and determine oldest and youngest among them.
-7.Write a program to print absolute vlaue of a number entered by user. E.g.- -INPUT: 1 OUTPUT: 1 -INPUT: -1 OUTPUT: 1
-8.A student will not be allowed to sit in exam if his/her attendence is less than 75%. -Take following input from user -Number of classes held -Number of classes attended. -And print -percentage of class attended -Is student is allowed to sit in exam or not.
-9.Modify the above question to allow student to sit if he/she has medical cause. Ask user if he/she has medical cause or not ( 'Y' or 'N' ) and print accordingly.
-10.If -x = 2 -y = 5 -z = 0 -then find values of the following expressions: -a. x == 2 -b. x != 5 -c. x != 5 && y >= 5 -d. z != 0 || x == 2 -e. !(y < 10)
-11.Write a program to check whether a entered character is lowercase ( a to z ) or uppercase ( A to Z ).
- -
-Level 2
-1.Write a program to check if a year is leap year or not. -If a year is divisible by 4 then it is leap year but if the year is century year like 2000, 1900, 2100 then it must be divisible by 400.
-2.Ask user to enter age, sex ( M or F ), marital status ( Y or N ) and then using following rules print their place of service. -if employee is female, then she will work only in urban areas. - -if employee is a male and age is in between 20 to 40 then he may work in anywhere - -if employee is male and age is in between 40 t0 60 then he will work in urban areas only. - -And any other input of age should print "ERROR".
-3.A 4 digit number is entered through keyboard. Write a program to print a new number with digits reversed as of orignal one. E.g.- -INPUT : 1234 OUTPUT : 4321 -INPUT : 5982 OUTPUT : 2895
diff --git a/Hima Rani Mathews/if-else/Reverse.cpp b/Hima Rani Mathews/if-else/Reverse.cpp deleted file mode 100644 index 6563e18..0000000 --- a/Hima Rani Mathews/if-else/Reverse.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -using namespace std; -int main(){ - int a,rev=0,r,b; - cout<<"\nEnter the integer : "; - cin>>a; - b=a; - while(a!=0){ - r=a%10; - rev=rev*10+r; - a=a/10; - } - cout<<"Reverse of String "< -using namespace std; -int main(){ - char ch; - cout<<"\nEnter the character : "; - cin>>ch; - if(ch>=65 && ch<=90) - cout<<"\n"<=97 && ch<=122) - cout<<"\n"< -using namespace std; -int main(){ - int a,b; - cout<<"\nEnter two integers : "; - cin>>a>>b; - if(a>b){ - cout< -using namespace std; -int main(){ - int l,b; - cout<<"\nEnter the Length and Breadth : "; - cin>>l>>b; - if(l==b){ - cout<<"Square"; - } - else - { - cout<<"Rectangle"; - } -} diff --git a/Jai Juneja/.gitignore b/Jai Juneja/.gitignore deleted file mode 100644 index f47cb20..0000000 --- a/Jai Juneja/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.out diff --git a/Jai Juneja/if_else_questions/level_1/absolute_value.cpp b/Jai Juneja/if_else_questions/level_1/absolute_value.cpp deleted file mode 100644 index 500d98d..0000000 --- a/Jai Juneja/if_else_questions/level_1/absolute_value.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -using namespace std; - -int main() { - int num; - cout << "Give number: "; - cin >> num; - - cout << "Absolute Value: "; - if (num >= 0) - cout << num << endl; - else - cout << -num << endl; - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_1/attendance.cpp b/Jai Juneja/if_else_questions/level_1/attendance.cpp deleted file mode 100644 index c664591..0000000 --- a/Jai Juneja/if_else_questions/level_1/attendance.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -#include - -using namespace std; - -int main() { - int classesHeld, classesAttended, percent; - - cout << "Give number of classes held: "; - cin >> classesHeld; - cout << "Give number of classes attended: "; - cin >> classesAttended; - - percent = (classesAttended * 100)/classesHeld; - - if (percent >= 75) - cout << "Student is allowed to sit for exam" << endl; - else - cout << "Student is not allowed to sit for exam" << endl; - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_1/attendance_variation.cpp b/Jai Juneja/if_else_questions/level_1/attendance_variation.cpp deleted file mode 100644 index c30033a..0000000 --- a/Jai Juneja/if_else_questions/level_1/attendance_variation.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -using namespace std; - -int main() { - int classesHeld, classesAttended, percent; - - cout << "Give number of classes held: "; - cin >> classesHeld; - cout << "Give number of classes attended: "; - cin >> classesAttended; - - percent = (classesAttended * 100)/classesHeld; - - if (percent >= 75) - cout << "Student is allowed to sit for exam" << endl; - else { - cout << "Do you have medical cause (y/n): "; - char ch; - cin >> ch; - if (ch == 'y') - cout << "Student is allowed to sit for exam" << endl; - else - cout << "Student is not allowed to sit for exam" << endl; - } - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_1/bonus_or_not.cpp b/Jai Juneja/if_else_questions/level_1/bonus_or_not.cpp deleted file mode 100644 index d936581..0000000 --- a/Jai Juneja/if_else_questions/level_1/bonus_or_not.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -using namespace std; - -int main() { - float salary, bonus = 0; - int yearsOfService; - - cout << "Give Salary: "; - cin >> salary; - cout << "Give years of service: "; - cin >> yearsOfService; - - if (yearsOfService > 5) - bonus = 0.05 * salary; - - cout << "Net Bonus Amount: " << bonus << endl; - - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_1/check_case.cpp b/Jai Juneja/if_else_questions/level_1/check_case.cpp deleted file mode 100644 index 0c3949e..0000000 --- a/Jai Juneja/if_else_questions/level_1/check_case.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -using namespace std; - -int main() { - char letter; - cout << "Give a letter: "; - cin >> letter; - - if (letter>=65 && letter<=90) - cout << "It is a uppercase letter" << endl; - else if (letter>=97 && letter<=122) - cout << "It is a lowercase letter" << endl; - - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_1/discount.cpp b/Jai Juneja/if_else_questions/level_1/discount.cpp deleted file mode 100644 index 4b1d3ee..0000000 --- a/Jai Juneja/if_else_questions/level_1/discount.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -using namespace std; - -int main() { - int quantity; - cout << "Give quantity: "; - cin >> quantity; - - int cost = 100 * quantity; - - if (cost > 1000) - cost = 0.9 * cost; - - cout << "The price is " << cost; - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_1/expressions.cpp b/Jai Juneja/if_else_questions/level_1/expressions.cpp deleted file mode 100644 index 2cbc6ee..0000000 --- a/Jai Juneja/if_else_questions/level_1/expressions.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -using namespace std; - -int main() { - int x=2, y=5, z=0; - cout << (x==2) << endl; - cout << (x!=5) << endl; - cout << ((x!=5) && (y>=5)) << endl; - cout << ((z!=0) || (x==2)) << endl; - cout << !(y<10) << endl; - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_1/find_grades.cpp b/Jai Juneja/if_else_questions/level_1/find_grades.cpp deleted file mode 100644 index c396a4a..0000000 --- a/Jai Juneja/if_else_questions/level_1/find_grades.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -using namespace std; - -int main() { - int marks; - - cout << "Give Marks: "; - cin >> marks; - - char grade; - - if (marks > 80) // 81 and above - grade = 'A'; - else if (marks > 60) // 61 - 80 - grade = 'B'; - else if (marks > 50) // 51 - 60 - grade = 'C'; - else if (marks > 45) // 46 - 50 - grade = 'D'; - else if (marks > 25) // 26 - 45 - grade = 'E'; - else // 25 and below - grade = 'F'; - - cout << "Your grade is " << grade; - - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_1/greatest_number.cpp b/Jai Juneja/if_else_questions/level_1/greatest_number.cpp deleted file mode 100644 index 128eb86..0000000 --- a/Jai Juneja/if_else_questions/level_1/greatest_number.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -using namespace std; - -int main() { - int num1, num2; - cout << "Enter two numbers: "; - cin >> num1 >> num2; - - if (num1 > num2) - cout << num1 << " is greatest" << endl; - else if (num1 < num2) - cout << num2 << " is greatest" << endl; - else - cout << "Both are equal" << endl; - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_1/oldest_and_youngest.cpp b/Jai Juneja/if_else_questions/level_1/oldest_and_youngest.cpp deleted file mode 100644 index b614cf4..0000000 --- a/Jai Juneja/if_else_questions/level_1/oldest_and_youngest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -using namespace std; - -int main() { - int ageA, ageB, ageC; - - cout << "Give ages of A, B and C: "; - cin >> ageA >> ageB >> ageC; - - int minimum = ageA, maximum = ageA; - char youngest = 'A', oldest = 'A'; - // for finding youngest - if (minimum > ageB) { - youngest = 'B'; - minimum = ageB; - } - if (minimum > ageC) { - youngest = 'C'; - minimum = ageC; - } - // for finding oldest - if (maximum < ageB) { - oldest = 'B'; - maximum = ageB; - } - if (maximum < ageC) { - oldest = 'C'; - maximum = ageC; - } - - cout << oldest << " is the oldest with age = " << maximum << endl; - cout << youngest << " is the youngest with age = " << minimum << endl; - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_1/rectangle_or_square.cpp b/Jai Juneja/if_else_questions/level_1/rectangle_or_square.cpp deleted file mode 100644 index 2743070..0000000 --- a/Jai Juneja/if_else_questions/level_1/rectangle_or_square.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -using namespace std; - -int main() { - int length, breadth; - cout << "Give length and breadth: "; - cin >> length >> breadth; - - if (length == breadth) - cout << "It is a square.." << endl; - else - cout << "It is a rectangle.." << endl; - - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_2/leap_year.cpp b/Jai Juneja/if_else_questions/level_2/leap_year.cpp deleted file mode 100644 index 11365e2..0000000 --- a/Jai Juneja/if_else_questions/level_2/leap_year.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include - -using namespace std; - -int main() { - unsigned int year; - cout << "Give the year: "; - cin >> year; - - bool leap = false; - - if (year%4 == 0) - leap = true; - if (year%100 == 0) { - leap = false; - if (year%400 == 0) - leap = true; - } - - if (leap) - cout << "It is a leap year"; - else - cout << "It is not a leap year"; - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_2/place_of_service.cpp b/Jai Juneja/if_else_questions/level_2/place_of_service.cpp deleted file mode 100644 index 385e0ea..0000000 --- a/Jai Juneja/if_else_questions/level_2/place_of_service.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -using namespace std; - -int main() { - unsigned int age; - char sex, maritalStatus; - cout << "Give Age: "; - cin >> age; - cout << "Give Sex(m/f): "; - cin >> sex; - cout << "Give marital status(y/n for married/single): "; - cin >> maritalStatus; - - if (sex == 'f') - cout << "You can work in urban areas only" << endl; - else if (sex == 'm') { - if (age>=20 && age<40) - cout << "You can work anywhere" << endl; - else if (age>=40 && age<=60) - cout << "You can work is urban areas only" << endl; - else - cout << "ERROR" << endl; - } - - return 0; -} diff --git a/Jai Juneja/if_else_questions/level_2/reverse_4digit_num.cpp b/Jai Juneja/if_else_questions/level_2/reverse_4digit_num.cpp deleted file mode 100644 index 30b2699..0000000 --- a/Jai Juneja/if_else_questions/level_2/reverse_4digit_num.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -using namespace std; - -int main() { - int num; - cout << "Give a 4-digit number: "; - cin >> num; - - int first = num%10; - int second = (num/10)%10; - int third = (num/100)%10; - int fourth = (num/1000)%10; - - cout << "Reversed number: "; - cout << first*1000 + second*100 + third*10 + fourth; - - return 0; -} diff --git a/Jai Juneja/loop_questions/even_sum.cpp b/Jai Juneja/loop_questions/even_sum.cpp deleted file mode 100644 index 0b94625..0000000 --- a/Jai Juneja/loop_questions/even_sum.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -using namespace std; - -int main() { - int n; - cout << "Give value of n: "; - cin >> n; - - int sum = 0; - for (int i = 2; i <= n; i += 2) - sum += i; - - cout << "Sum of all even numbers upto " << n << " is " << sum << endl; - return 0; -} diff --git a/Jai Juneja/loop_questions/find_factors.cpp b/Jai Juneja/loop_questions/find_factors.cpp deleted file mode 100644 index 82153b4..0000000 --- a/Jai Juneja/loop_questions/find_factors.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -using namespace std; - -int main() { - int num; - cout << "Give number: "; - cin >> num; - - cout << "The factors are: 1 "; - for (int i = 2; i <= num/2; i++) { - if (num%i == 0) - cout << i << " "; - } - cout << num << endl; - return 0; -} diff --git a/Jai Juneja/loop_questions/find_hcf.cpp b/Jai Juneja/loop_questions/find_hcf.cpp deleted file mode 100644 index ea8672d..0000000 --- a/Jai Juneja/loop_questions/find_hcf.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -using namespace std; - -int main() { - int num1, num2; - cout << "Give two numbers: "; - cin >> num1 >> num2; - - // assume, mnum2) { - m = num2; - n = num1; - } else { - m = num1; - n = num2; - } - - int rem = n%m; - while (rem != 0) { - n = m; - m = rem; - rem = n%m; - } - - cout << "HCF of " << num1 << " and " << num2 << " is " << m; - return 0; -} diff --git a/Jai Juneja/loop_questions/first_last_digits.cpp b/Jai Juneja/loop_questions/first_last_digits.cpp deleted file mode 100644 index 1163243..0000000 --- a/Jai Juneja/loop_questions/first_last_digits.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -using namespace std; - -int main() { - int num, firstDigit, lastDigit; - cout << "Give number: "; - cin >> num; - - lastDigit = num % 10; - firstDigit = num; - while (firstDigit >= 10) { - firstDigit = firstDigit/10; - } - - cout << "First digit: " << firstDigit << endl; - cout << "Last digit: " << lastDigit << endl; - return 0; -} diff --git a/Jai Juneja/loop_questions/multiplication_table.cpp b/Jai Juneja/loop_questions/multiplication_table.cpp deleted file mode 100644 index a0fdb2c..0000000 --- a/Jai Juneja/loop_questions/multiplication_table.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -using namespace std; - -int main() { - int n; - cout << "Give number for which multiplication table is to be printed: "; - cin >> n; - - for (int i = 1; i < 11; i++) { - cout << n << " * " << i << " = " << n*i << endl; - } - - return 0; -} diff --git a/Jai Juneja/loop_questions/natural_nums.cpp b/Jai Juneja/loop_questions/natural_nums.cpp deleted file mode 100644 index fbe0b64..0000000 --- a/Jai Juneja/loop_questions/natural_nums.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -using namespace std; - -int main() { - int n; - cout << "Give value of n: "; - cin >> n; - - cout << "Natural numbers from 1 to " << n << " are: " << endl; - for (int i = 1; i <= n; i++) { - cout << i << ' '; - } - return 0; -} diff --git a/Jai Juneja/loop_questions/natural_nums_reverse.cpp b/Jai Juneja/loop_questions/natural_nums_reverse.cpp deleted file mode 100644 index 49f5a7a..0000000 --- a/Jai Juneja/loop_questions/natural_nums_reverse.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -using namespace std; - -int main() { - int n; - cout << "Give the value of n: "; - cin >> n; - - cout << "Natural numbers in reverse order from " << n << " to 1 are:" << endl; - for (int i = n; i > 0; i--) { - cout << i << ' '; - } - return 0; -} diff --git a/Jai Juneja/loop_questions/odd_sum.cpp b/Jai Juneja/loop_questions/odd_sum.cpp deleted file mode 100644 index a95b37a..0000000 --- a/Jai Juneja/loop_questions/odd_sum.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include - -using namespace std; - -int main() { - int n, sum = 0; - cout << "Give value of n: "; - cin >> n; - - for (int i = 1; i <= n; i += 2) - sum += i; - - cout << "Sum of odd numbers upto " << n << " is " << sum << endl; - return 0; -} diff --git a/Jai Juneja/loop_questions/reverse_number.cpp b/Jai Juneja/loop_questions/reverse_number.cpp deleted file mode 100644 index 36cfa3c..0000000 --- a/Jai Juneja/loop_questions/reverse_number.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -using namespace std; - -int main() { - int num, rem, reversed = 0; - cout << "Give number: " << endl; - cin >> num; - - int temp = num; - while (temp) { - rem = temp % 10; - reversed = reversed*10 + rem; - temp /= 10; - } - - cout << reversed; - return 0; -} diff --git a/Jai Juneja/loop_questions/swap_first_last.cpp b/Jai Juneja/loop_questions/swap_first_last.cpp deleted file mode 100644 index 6ed4ce4..0000000 --- a/Jai Juneja/loop_questions/swap_first_last.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include - -using namespace std; - -int main() { - int num; - cout << "Give number: "; - cin >> num; - - int numOfDigits = 1, firstDigit = num, lastDigit = num%10; - while (firstDigit >= 10) { - firstDigit /= 10; - numOfDigits++; - } - - int swappedNum = num - lastDigit + firstDigit; // swapping last digit with first digit - int temp = 1; // power of 10 for first digit - for (int i = 1; i < numOfDigits; i++) - temp *= 10; - swappedNum = swappedNum + (lastDigit - firstDigit)*temp; // swapping first digit with last digit - - cout << "After swapping first and last digits, the number is " << swappedNum << endl; - return 0; -} diff --git a/Ritika/If-else/absolute/absolute.cpp b/Ritika/If-else/absolute/absolute.cpp deleted file mode 100644 index 5d88ade..0000000 --- a/Ritika/If-else/absolute/absolute.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int x; - cout<<"Enter a number:"<> x; - if (x > 0) - { - cout << x << endl; - } - else if (x < 0) - { - cout << -x << endl; - } - else - cout << 0 << endl; - return 0; -} diff --git a/Ritika/If-else/bonus/bonus.cpp b/Ritika/If-else/bonus/bonus.cpp deleted file mode 100644 index bff43a3..0000000 --- a/Ritika/If-else/bonus/bonus.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -using namespace std; -int main() -{ -int sal, yoe; -cout<<"Enter your salary"<>sal; -cout<<"Enter your years of experience"<>yoe; - -if(yoe>5) -{ - cout<<"You get a 5% bonus. Your net bonus amount is "<<(.05*sal)< -using namespace std; -int main() -{ - int quantity; - cout<<"Enter the quantity of the goods purchased:"<>quantity; -if((quantity*100)>1000) -{ - - cout<<"You get a discount of "<<(.1*quantity*100)<<" and your total cost is" << ((quantity*100)-(.1*quantity*100))< - -using namespace std; - -int main() -{ - int age; - char sex,married; - cout<<"Enter your age and sex(F or M)"<>age>>sex>>married; - if(sex=='F'){ - cout << "urban area" <20 && age<40)){ - cout << "anywhere" << endl; - } - else if(sex=='M' && (age>=40 && age<60)){ - cout << "urban area" < - -using namespace std; - -int main() -{ - int x=2; - int y=5; - int z=0; - cout << (x==2) << endl; - cout << (x!=5) << endl; - cout << (x!=5 && y>=5) << endl; - cout << (z!=0 || x==2) << endl; - cout << (!(y<10)) < -using namespace std; -int main() -{ -int marks; -cout<<"Enter marks:"<>marks; -if(marks<25) -{ - cout<<"F"<=25)&&(marks<45)) -{ - cout<<"E"<=45)&&(marks<50)) -{ - cout<<"D"<=50)&&marks<60) -{ - cout<<"C"<=60)&&(marks<80)) -{ - cout<<"B"<=80)&&marks<=100) -{ - cout<<"A"< -using namespace std; - -int main() -{ -int a,b; - -cout<<"Enter two integers"<>a>>b; -if(a>b) -{ - cout< - -using namespace std; - -int main() -{ - int year; - cout<<"Enter a year"<>year; - if(year%400==0){ - cout << "leap year" < -using namespace std; -int main() -{ - - -int l, b; -cout<<"Enter length and breadth of the figure:"<>l>>b; -if(l==b) -{ - - cout<<"It is a square"< - -using namespace std; - -int main() -{ - double classes_held,classes_attended; - char medical_cause; - cout<<"Enter the number of classes held ,classes attended and if there was a medical cause or not(Y OR N)"<>classes_held>>classes_attended>>medical_cause; - double attendance=(classes_attended/classes_held)*100; - cout << "attendance = " << attendance << "%" << std::endl; - if(attendance<75.0){ - if(medical_cause=='Y') { cout << "allowed to sit in exam" << endl; } - else { - cout << "not allowed to sit in exam" << endl; - } - } - else { - cout << "allowed to sit in exam" << endl; - } - return 0; -} diff --git a/Ritika/If-else/oldest_youngest/oldest_youngest.cpp b/Ritika/If-else/oldest_youngest/oldest_youngest.cpp deleted file mode 100644 index 6514990..0000000 --- a/Ritika/If-else/oldest_youngest/oldest_youngest.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -#include - -using namespace std; - -int main() -{ - int a1,a2,a3; - cin>>a1>>a2>>a3; - int oldest,youngest; - if(a1>a2){ - if(a1>a3){ - oldest=a1; - if(a3>a2) youngest=a2; - else youngest=a3; - } - else{ - oldest=a3; - youngest=a2; - } - } - - else{ - if(a2>a3){ - oldest=a2; - if(a3>a1) youngest=a1; - else youngest=a3; - } - else{ - oldest=a3; - youngest=a1; - } - } - cout << "oldest=" << oldest << endl; - cout << "youngest=" << youngest << endl; - - return 0; -} - diff --git a/Ritika/If-else/reverse_digit/reverse_digit.cpp b/Ritika/If-else/reverse_digit/reverse_digit.cpp deleted file mode 100644 index 0d4e9f3..0000000 --- a/Ritika/If-else/reverse_digit/reverse_digit.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int n,reversed_no=0; - cout<<"Enter a number:"<>n; - while(n){ - int digit=n%10; - reversed_no=reversed_no*10+digit; - n/=10; - } - cout << "reversed number = " << reversed_no << endl; - return 0; -} diff --git a/Ritika/If-else/stu_can_sit_or_not/attendance.cpp b/Ritika/If-else/stu_can_sit_or_not/attendance.cpp deleted file mode 100644 index c6f6f80..0000000 --- a/Ritika/If-else/stu_can_sit_or_not/attendance.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include - -using namespace std; - -int main() -{ - double classes_held,classes_attended; - cout<<"Enter the number of classes held and classes attended"<>classes_held>>classes_attended; - double attendance=(classes_attended/classes_held)*100; - cout << "attendance = " << attendance << "%" << endl; - if(attendance<75.0){ - cout << "not allowed to sit in exam" << endl; - } - else { - cout << "allowed to sit in exam" << endl; - } - return 0; -} diff --git a/Ritika/If-else/uppercase_lowercase/uppercase_lowercase.cpp b/Ritika/If-else/uppercase_lowercase/uppercase_lowercase.cpp deleted file mode 100644 index 0950708..0000000 --- a/Ritika/If-else/uppercase_lowercase/uppercase_lowercase.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -using namespace std; - -int main() -{ - char c; - cout<<"Enter a character:"<>c; - int x=(int)c; - if(c>=97 && c<=122){ - cout << "lowercase" << endl; - } - else if(c>=65 && c<=90){ - cout << "uppercase" << endl; - } - - else - { - cout<<"Character is invalid"< -using namespace std; -int main() -{ - int en; - - cout<<"Enter the ending number:"<>en; - cout<<"All the natural numbers from 1 to "< -using namespace std; -int main() -{ - int i, n; - - - cout<<"Print all even numbers till: "<>n; - - cout<<"Even numbers from 1 to"<< n << " are:" < -using namespace std; -int main() -{ - int start; - - cout<<"Enter the starting number:"<>start; - cout<<"All the natural numbers from " <=1;i--) - { - cout< -using namespace std; - -int main() -{ - char ch; - - cout<<"Alphabets from a - z are:"< -using namespace std; - -int main() -{ - int n, num, rev = 0; - - cout<<"Enter any number:"<>n; - - num = n; - - - while(n != 0) - { - rev = (rev * 10) + (n % 10); - n /= 10; - } - - - if(rev == num) - { - cout< -using namespace std; - -int main() -{ - int num, sum=0; - - cout<<"Enter any number to find sum of its digit: "<>num; - - while(num!=0) - { - - sum += num % 10; - - - num = num / 10; - } - - cout<<"Sum of digits is:"<< sum< -using namespace std; - -int main() -{ - int i, num; - - - cout<<"Enter number to print table: "<>num; - - for(i=1; i<=10; i++) - { - cout<>n; - - - for(i=2; i<=n; i+=2) - { - - sum += i; - } - - cout<<"Sum of all even number between 1 to"<< n<<" = "<< sum< -using namespace std; - -int main() -{ - int num; - int count = 0; - cout<<"enter any number:"<>num; - do - { - count++; - num /= 10; - } while(num != 0); - - cout<<"Total digits:"< -using namespace std; -int main() -{ - int num; - long long product=1ll; - - cout<<"Enter any number to calculate product of digit: "<>num; - - product = (num == 0 ? 0 : 1ll); - - /* Repeat the steps till num becomes 0 */ - while(num != 0) - { - product = product * (num % 10); - num = num / 10; - } - - cout<<"product of digits is " < - -using namespace std; - - -int main() -{ - char i ; -cout<<"Alphabets from a to z are"< - -using namespace std; - -int main() -{ - int n,count=0; - cout<< "Enter a limit of even numbers to count: "; - cin>>n; - cout< - -using namespace std; - - -int main() -{ - int n, last, first ; - - - cout<<"Enter any number: "; - cin>>n; - last = n % 10; - first=n; - while(first>=10) - { - first=first/10; - } -cout< - -using namespace std; - -int main() -{ - int n,count=0; - cout <<"Enter Natural number limit to find: "; - cin >>n; - cout < - -using namespace std; - -int main() -{ - int n,count=1; - cout<< "Enter a limit of even numbers to count: "; - cin>>n; - cout< - -using namespace std; - -int main() -{ - int n; - cout<< "Enter a limit from which natural number is reversed: "; - cin>>n; - cout<=1) - { - cout<< n << "\t"; - n--; - - } -} diff --git a/Sawtantar/Loops/sumeven.cpp b/Sawtantar/Loops/sumeven.cpp deleted file mode 100644 index 2a92bc1..0000000 --- a/Sawtantar/Loops/sumeven.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int num, count = 1, sum = 0; - - cout<<"Enter the limit: "; - cin>>num; - - while(count <= num) - { - if(count%2 == 0) - { - sum = sum + count; - } - count++; - } - cout<<"Sum of Even numbers are: "< - -using namespace std; - -int main() -{ - int num, count = 1, sum = 0; - - cout<<"Enter the limit: "; - cin>>num; - - while(count <= num) - { - - { - sum = sum + count; - } - count++; - } - cout<<"Sum of natural numbers are: "< - -using namespace std; - -int main() -{ - int num, count = 1, sum = 0; - - cout<<"Enter the limit: "; - cin>>num; - - while(count <= num) - { - if(count%2 != 0) - { - sum = sum + count; - } - count++; - } - cout<<"Sum of odd numbers are: "< - -using namespace std; - -int main() -{ - int num,i; - - cout<<"Enter a number: "; - cin>>num; - cout<>a; - if(a<0) - { - cout< -using namespace std; -int main(){ - int a,b,c; - - cout<<"Enter Person 1's age: "; - cin>>a; - cout <>b; - cout <>c; - if(a>b && a>c ) - { - cout << endl << "Person 1 is oldest of all"; - } - else if(b>a && b>c) - { - cout << endl << "Person 2 is oldest of all"; - } - else - { - cout << endl << "Person 3 is oldest of all"; - } - - - - return 0; -} \ No newline at end of file diff --git a/Sawtantar/if else/attendence.cpp b/Sawtantar/if else/attendence.cpp deleted file mode 100644 index 02429d6..0000000 --- a/Sawtantar/if else/attendence.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -using namespace std; -int main() -{ - float total_classes,attended; - - cout<<"Enter the number of classes held : "; - cin>>total_classes; - - cout<<"Enter the number of classes attended : "; - cin>>attended; - - float attendance=(attended/total_classes)*100; - cout<<"Your attendance is "<=75) - { - cout<<"You are permitted to write your exam"; - } - else - { - cout<<"You are NOT permitted to write your exam"; - } - return 0; -} \ No newline at end of file diff --git a/Sawtantar/if else/attendence2.cpp b/Sawtantar/if else/attendence2.cpp deleted file mode 100644 index d24816b..0000000 --- a/Sawtantar/if else/attendence2.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -#include -using namespace std; -int main() -{ - float total_classes,attended; - - - cout<<"Enter the number of classes held : "; - cin>>total_classes; - - cout<<"Enter the number of classes attended : "; - cin>>attended; - - - - float attendance=(attended/total_classes)*100; - cout<<"Your attendance is "<=75) - { - cout <>medical; - if(medical=='Y'||medical=='y') - cout< -using namespace std; -int main() -{ - int salary , years; - - cout<<"Enter Salary : "; - cin>>salary; - - cout<<"Enter Years of Service : "; - cin>>years; - - if(years>5) - { - int bonus=salary+(salary*5)/100; - cout<<"The net bonus amount is "< -using namespace std; -int main() -{ - cout<<"Enter quantities purchased : "; - int n; - cin>>n; - int original_quantity=n*100; - int new_quantity=0; - int ans=0; - if(original_quantity>1000){ - new_quantity=(original_quantity*10)/100; - ans=original_quantity-new_quantity; - cout<<"You got a 10% discount!"< -using namespace std; -int main() -{ - int x=2,y=5,z=0; - cout<<(x==2)<= 5)< -using namespace std; -int main() -{ - int mark; - cout<<"Please Enter your marks: "; - cin>>mark; - if(mark>=80 && mark<=100) - { - cout<<"Your Grade is A"<=60 && mark<80) - { - cout<<"Your Grade is B"<=50 && mark<60) - { - cout<<"Your Grade is C"<=45 && mark<50) - { - cout<<"Your Grade is D"<=25 && mark<45) - { - cout<<"Your Grade is E"< - -using namespace std; - -int -main () -{ - int a, b; - cout << "Enter Value of Number A " << endl; - cin >> a; - cout << endl << "Enter Vaue of Number B " << endl; - cin >> b; - if (a > b) - { - cout << endl << "Number A is greater than B"; - } - else - { - cout << endl << "Number B is greater than A"; - } - return 0; -} diff --git a/Sawtantar/if else/leapyear.cpp b/Sawtantar/if else/leapyear.cpp deleted file mode 100644 index a23e4e9..0000000 --- a/Sawtantar/if else/leapyear.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -using namespace std; -int main2(){ - int year; - cout<<"Enter a year: "; - cin>>year; - if(year%400==0){ - cout<<"Leap Year"; - } - else if(year%100==0){ - cout<<"Not Leap Year"; - } - else if(year%4==0){ - cout<<"Leap Year"; - } - else - cout<<"Not Leap Year"; - return 0; -} \ No newline at end of file diff --git a/Sawtantar/if else/reverse.cpp b/Sawtantar/if else/reverse.cpp deleted file mode 100644 index d6732fa..0000000 --- a/Sawtantar/if else/reverse.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -using namespace std; -int main(){ - int n,a; - cout<<"Enter a number : "; - cin>>n; - while(n!=0){ - a=n%10; - n=n/10; - cout< -using namespace std; -int main(){ - int age; - char gender; - char martial_status; - cout<<"Enter your age : "; - cin>>age; - cout<<"Enter your sex [M or F] : "; - cin>>gender; - cout<<"Enter your martial status [Y or N] : "; - cin>>martial_status; - if(gender=='F'||gender=='f') - { - cout<<"Place of Service: Urban Areas"; - } - else if(gender=='M'||gender=='m'&& (age>=20 && age<=40)) - { - cout<<"Place of Serivce: Anywhere"; - } - else if(gender=='M'||gender=='m'&& (age>=40 && age<=60)) - { - cout<<"Place of Serivce: Urban Areas"; - } - else if(age<20 || age>60) - { - cout<<"ERROR"; - } - else if(martial_status !='Y'|| martial_status!='N'||martial_status !='y'|| martial_status!='n') - { - cout<<"Invalid Option"; - } - else{ - cout<<"Invalid Option"; - } - return 0; -} \ No newline at end of file diff --git a/Sawtantar/if else/square.cpp b/Sawtantar/if else/square.cpp deleted file mode 100644 index de5c37a..0000000 --- a/Sawtantar/if else/square.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/****************************************************************************** - - Online C++ Compiler. - Code, Compile, Run and Debug C++ program online. -Write your code in this editor and press "Run" button to compile and execute it. - -*******************************************************************************/ - -#include - -using namespace std; - -int main() -{ - int l,b; - cout << "Enter Value of Length " << endl; - cin>>l; - cout <>b; - if(l==b) - { - cout < -using namespace std; -int main1() -{ - char ch; - - cout <<"Enter any character: "; - cin >>ch; - - - if(ch >= 'A' && ch <= 'Z') - { - cout<<"it is uppercase alphabet."; - } - else if(ch >= 'a' && ch <= 'z') - { - cout<< "is lowercase alphabet."; - } - else - { - cout<<"is not an alphabet."; - } - - return 0; -} \ No newline at end of file diff --git a/Sawtantar/sawtantar.txt b/Sawtantar/sawtantar.txt deleted file mode 100644 index e69de29..0000000 diff --git a/prabhjot singh/array/cpyarray.cpp b/prabhjot singh/array/cpyarray.cpp new file mode 100644 index 0000000..e53026b --- /dev/null +++ b/prabhjot singh/array/cpyarray.cpp @@ -0,0 +1,25 @@ +#include +using namespace std; +int main() +{ int a[10],b[10],i,ncount=0; +cout<<"enter the array\n"; +for(i=0;i<10;i++) +{ + cin>>a[i]; + b[i]=a[i]; +} + +cout<<"entered array:"; +for(i=0;i<10;i++) +{ + cout< +using namespace std; +int main() +{ int a[10],i,count=0,dup,n; +cout<<"enter array size:"; +cin>>n; +cout<<"\nenter the array\n"; +for(i=0;i>a[i]; + +} +for(i=0;i +using namespace std; +int main() +{int a[10],i,n,pos,item; +cout<<"\nenter array size(max. 10) :"; +cin>>n; +cout<<"\nenter array :"; +for ( i = 0; i < n; i++) +{cin>>a[i]; +} +cout<<"\narray before deletion:"; +for ( i = 0; i < n; i++) +{cout<>pos; +if(pos +using namespace std; + +int main() +{ int a[10],i,ecount=0,ocount=0; +cout<<"enter the array\n"; +for(i=0;i<10;i++) +{ + cin>>a[i]; +} + +for(i=0;i<10;i++) +{ + if(a[i]%2==0) + { ecount++;} + else + {ocount++;} +} +cout<<"total even numbers :"< +using namespace std; +int main() +{int a[10],i,r,j,temp,n; +cout<<"enter the size of array(max. 10):"; +cin>>n; +cout<<"\nenter the array:"; +for(i=0;i>a[i]; +} +cout<< "\narray is:"; +for(i=0;i>r; +for(i=0;i +using namespace std; +int main() +{ +int a[5][5],b[5][5],c[5][5],i,j,n,m,p,q; +cout<<"Enter the row and coloumn of matrix 1 (max.5)\n "; +cin>>n; +cout<<"*"; +cin>>m; +cout<<"Enter the row and coloumn of matrix 2 (max.5) \n"; +cin>>p; +cout<<"*"; +cin>>q; + +if (m==p) +{ +cout<<"\nMultiplication possible "<>a[i][j]; +} +cout<<"\nElements of matrix 1 are "; +for (i=1;i<=n;i++) +{ +cout<>b[i][j]; +} +cout<<"\nElements of matrix 2 are \n"; +for (i=1;i<=p;i++) +{ +cout< +using namespace std; +int main() +{ + int a[10], b[20], c[50], i, j, k, f, s, m; + cout << "\nenter the size of first array:"; + cin >> f; + cout << "\nenter the size of second array:"; + cin >> s; + cout << "\nenter the first array:"; + for (i = 0; i < f; i++) + { + cin >> a[i]; + } + cout << "\nenter the second array:"; + for (j = 0; j < s; j++) + { + cin >> b[j]; + } + i = 0, j = 0; + m = f + s; + for (k = 0; k < m; k++) + { + if (i < f) + { + c[k] = a[i]; + i++; + } + else + { + c[k] = b[j]; + j++; + } + } + cout << "\n array after merged:\n"; + for (k = 0; k < m; k++) + cout << c[k] << " "; + return 0; +} \ No newline at end of file diff --git a/prabhjot singh/array/negativenumber.cpp b/prabhjot singh/array/negativenumber.cpp new file mode 100644 index 0000000..dddb9b7 --- /dev/null +++ b/prabhjot singh/array/negativenumber.cpp @@ -0,0 +1,20 @@ +#include +using namespace std; +int main() +{ int a[10],i,ncount=0; +cout<<"enter the array\n"; +for(i=0;i<10;i++) +{ + cin>>a[i]; +} + +for(i=0;i<10;i++) +{ + if(a[i]<0) + { ncount++;} + +} +cout<<"total negative numbers :"< +using namespace std; +int main() +{ int a[10],i,count=0,dup; +cout<<"enter the array\n"; +for(i=0;i<10;i++) +{ + cin>>a[i]; + +} +for(i=0;i<10;i++) +{ + dup=a[i]; + for(int j=i+1;j<10;j++) + { if(dup==a[j]) + { + count++; + } + } + +} +cout<<"no. of duplicate value: "< +using namespace std; +int sum = 0, a[10], i, n; +int rsum(int s) +{ + while (i >= 0) + sum = sum + s + rsum(a[--i]); + return sum; +} +int main() +{ + cout << "\nenter array size(max. 10) :"; + cin >> n; + cout << "\nenter array :"; + for (i = 0; i < n; i++) + { + cin >> a[i]; + } + rsum(a[--i]); + cout << "\nsum:" << sum; + return 0; +} diff --git a/prabhjot singh/array/reversearray.cpp b/prabhjot singh/array/reversearray.cpp new file mode 100644 index 0000000..83233d8 --- /dev/null +++ b/prabhjot singh/array/reversearray.cpp @@ -0,0 +1,19 @@ +#include +using namespace std; +int main() +{int a[10],i,n; +cout<<"enter the size of array(max. 10):"; +cin>>n; +cout<<"\nenter the array:"; +for(i=0;i>a[i]; +} +cout<< "\narray is:"; +for(i=0;i=0;i--) +cout< +using namespace std; +int main() +{int a[10],i,r,j,temp,n; +cout<<"enter the size of array(max. 10):"; +cin>>n; +cout<<"\nenter the array:"; +for(i=0;i>a[i]; +} +cout<< "\narray is:"; +for(i=0;i>r; +for(i=0;i0;j--) + { a[j]=a[j-1]; } + a[0]=temp; +} +cout<<"array after "< +using namespace std; +int main() +{ + int a[10], i,seclarge,large; + cout << "enter the array\n"; + for (i = 0; i < 10; i++) + { + cin >> a[i]; + } + + large=a[0]; + for (i = 1; i < 10; i++) + { + if (large +using namespace std; +int main() +{ + int even[5], odd[5], a[5], i, j, k,f,s,m; + cout << "\nenter the size of array(max.5):"; + cin >> m; + cout << "\nenter the array:"; + for (i = 0; i < m; i++) + { + cin >> a[i]; + } + i = 0, j = 0; + for (i = 0; i < m; i++) + { + if (a[i]%2==0) + { + even[j] = a[i]; + j++; + } + else + { + odd[k] = a[i]; + k++; + } + } + f=j; + s=k; + cout << "\n array of even nummbers:\n"; + for (j = 0; j < f; j++) + cout <