Author: Md Jakaria Nur

  • Introduction to Robotics

    Introduction to Robotics

    Robotics is a branch of engineering and science that includes electronics engineering, mechanical engineering and computer science and so on.

    This branch deals with the design, construction, use to control robots, sensory feedback and information processing. These are some technologies which will replace humans and human activities in coming years.

    What is Robot?

    A robot is an electromechanical or autonomous device or machine capable of sensing its environment, carrying out computations to make decisions, and performing actions in the real world.

    Characteristics

    There are some characteristics of robots given below:

    • Appearance:

    Robots have a physical body. They are held by the structure of their body and are moved by their mechanical parts. Without appearance, robots will be just a software program.

    • Brain:

    Another name of brain in robots is On-board control unit. Using this robot receive information and sends commands as output. With this control unit robot knows what to do else it’ll be just a remote-controlled machine.

    • Sensors:

    The use of these sensors in robots is to gather info from the outside world and send it to Brain. Basically, these sensors have circuits in them that produces the voltage in them.

    • Actuators:

    The robots move and the parts with the help of these robots move is called Actuators. Some examples of actuators are motors, pumps, and compressor etc. The brain tells these actuators when and how to respond or move.

    • Program:

    Robots only works or responds to the instructions which are provided to them in the form of a program. These programs only tell the brain when to perform which operation like when to move, produce sounds etc. These programs only tell the robot how to use sensors data to make decisions.

    • Behaviour:

    Robots behavior is decided by the program which has been built for it. Once the robot starts making the movement, one can easily tell which kind of program is being installed inside the robot.

    Types of Robots

    These are the some types of robots given below:

    • Articulated: The feature of this robot is its rotary joints and range of these are from 2 to 10 or more joints. The arm is connected to the rotary joint and each joint is known as the axis which provides a range of movements.
    • Cartesian: These are also known as gantry robots. These have three joints which use the Cartesian coordinate system i.e x, y, z. These robots are provided with attached wrists to provide rotatory motion.
    • Cylindrical: These types of robots have at least one rotatory joints and one prismatic joint which are used to connect the links. The use of rotatory joints is to rotate along the axis and prismatic joint used to provide linear motion.
    • Polar: These are also known as spherical robots. The arm is connected to base with a twisting joint and have a combination of 2 rotatory joint and one linear joint.
    • Scara: These robots are mainly used in assembly applications. Its arm is in cylindrical in design. It has two parallel joints which are used to provide compliance in one selected plane.
    • Delta: The structure of these robots are like spider-shaped. They are built by joint parallelograms that are connected to the common base. The parallelogram moves in a dome-shaped work area. These are mainly used in food and electrical industries.

    Scope and limitations of robots:

    The advance version of machines are robots which are used to do advanced tasks and are programmed to make decisions on their own.

    When a robot is designed the most important thing to be kept in mind is that What the function is to be performed and what are the limitations of the robot.

    Each robot has a basic level of complexity and each of the levels has the scope which limits the functions that are to be performed.

    For general basic robots, their complexity is decided by the number of limbs, actuators and the sensors that are used while for advanced robots the complexity is decided by the number of microprocessors and microcontroller used.

    As increasing any component in the robot, it is increasing the scope of the robot and with every joint added, the degree of the robot is enhanced.

    Thanks for your time!

  • Corporate Culture and Technological Skills

    Corporate Culture and Technological Skills

    Corporate culture and technological skills are crucial aspects of success in today’s business world.

    Understanding the importance of a strong corporate culture and the technological skills required for various industries is essential for both employees and organizations.

    This lecture note aims to provide students with an understanding of these key concepts and their relevance in the modern workplace.

    Orientation of Organization/Corporate Culture

    Corporate culture refers to the shared values, beliefs, and practices that shape the behavior of an
    organization’s members. It influences how employees interact with one another, make decisions,
    and approach their work.

    A strong corporate culture can foster employee engagement, improve performance, and contribute to a company’s overall success.

    Key components of Organization/corporate culture include

    1. Vision and mission: The organization’s purpose, goals, and direction.
    2. Values and beliefs: The guiding principles and ethics that drive behavior and decision-making.
    3. Communication and collaboration: The way information is shared and how employees work together.
    4. Leadership style: The approach taken by management in guiding, motivating, and supporting employees.
    5. Employee recognition and reward: The systems in place to acknowledge and incentivize performance.

    Technological Skills for Industries

    Technological skills refer to the knowledge and abilities needed to use, understand, and evaluate technology effectively.

    These skills are essential for success in a wide range of industries, as technology continues to play an increasingly significant role in business operations.

    Key technological skills for industries include
    1. Computer proficiency: Familiarity with basic computer functions, operating systems, and software applications (e.g., Microsoft Office Suite)
    2. Internet navigation and research: The ability to effectively search for, evaluate, and utilize online information
    3. Data analysis and visualization: The skills to collect, analyze, and interpret data using various tools (e.g., Excel, Tableau)
    4. Coding and programming: Knowledge of programming languages (e.g., Python, Java) and the ability to develop software, websites, or applications
    5. Cybersecurity: Awareness of online threats and the measures to protect sensitive information and systems

    Building a Strong Organization/Corporate Culture and Developing Technological Skills:
    To create a strong corporate culture and enhance technological skills within an organization, consider the following strategies:
    1. Clearly define and communicate the organization’s vision, mission, and values to employees
    2. Encourage open and transparent communication, collaboration, and feedback
    3. Invest in employee development, providing opportunities for training and skill-building in relevant technologies
    4. Foster an inclusive and diverse workplace, promoting innovation and creative problem-solving
    5. Recognize and reward employees for their efforts, both individually and as a team

    Understanding the importance of corporate culture and technological skills for industries is vital
    for employees and organizations alike. By cultivating a strong corporate culture and equipping
    employees with the necessary technological skills, companies can improve performance, drive
    innovation, and maintain a competitive edge in the market. As a student, familiarizing yourself
    with these concepts and continually developing your technical skills will enhance your future
    employability and success in the workforce.

    Assessment Plan
    1. Group Activity: Students will work in groups to analyze the corporate culture of a chosen IT based company.

    Each group will present their findings, including the company’s mission, values, and how they foster a strong corporate culture.

    2. Individual Assignment: Students will write a brief essay explaining the importance of technological skills in their chosen industry, including specific examples of skills that are essential for success.

    Question & Answer
    Q1: What are the key components of Organization/corporate culture?
    A1: The key components of Organization/corporate culture include vision and mission, values and beliefs, communication and collaboration, leadership style, and employee recognition and reward systems.

    Why is understanding organization/corporate culture important for the employee?

    Q2: Why is it important for employees to develop technological skills?
    A2: Developing technological skills is essential for employees to effectively utilize and adapt to new technologies, increase their productivity, enhance their career prospects, and contribute to the overall success of the organization.

  • C Programming Entire Topics Practice

    C Programming Entire Topics Practice

    Topics-01: Overview of C

    Problem – 01

    Printing “Hello World!”.

    #include <stdio.h>
    int main()
    {
    printf("Hello World!");
    return 0;
    }

    Problem – 02

    Printing two sentences on two different lines. (Using of \n)

    #include <stdio.h>
    int main()
    {
    printf("Hello\nWorld!");
    return 0;
    }

    Problem – 03

    Print a line in a quotation mark (For example: “Hello World”.)

    #include <stdio.h>
    int main()
    {
    printf("\"Hello World!\"");
    return 0;
    }

    Topics-02 : Data Types and Variables

    Problem – 01

    Taking 2 integer numbers as input and then add, subtract, multiply and divide them.
    Finally print the output results.

    #include <stdio.h>
    int main() {
    float a, b, sum, sub, mul, dev;
    printf("Enter First number: ");
    scanf("%f", &a);
    printf("Enter Second number: ");
    scanf("%f", &b);
    sum=a+b;
    sub=a-b;
    mul=a*b;
    dev=a/b;
    printf("The Two Number Addition is: %.4f\n", sum);
    printf("The Two Number Substrction is: %.4f\n", sub);
    printf("The Two Number Multification is: %.4f\n", mul);
    printf("The Two Number Divided is: %.4f\n", dev);
    return 0;
    }

    Problem – 02

    Taking 3 float numbers and calculating the average of them.

    #include <stdio.h>
    int main()
    {
    float a,b,c, avr;
    printf("Enter Three number: ");
    scanf("%f %f %f", &a, &b, &c);
    avr=(a+b+c)/3;
    printf("The Floating Average Number is: %.4f\n", avr);
    return 0;
    }

    Problem – 03

    The length & breadth of a rectangle are input through the keyboard. Find out the
    rectangle’s area.
    #include <stdio.h>
    int main() {
    float lenth, breadth, area;
    printf("Enter First number: ");
    scanf("%f", &lenth);
    printf("Enter Second number: ");
    scanf("%f", &breadth);
    area = lenth*breadth;
    printf("The Rectangular Area is: %.4f\n", area);
    return 0; }

    Problem – 04

    Temperature of a city in Fahrenheit degrees is input through the keyboard. Write a
    program to convert this temperature into Centigrade degrees.
    fahrenheit=(celcius*9/5)+32
    #include <stdio.h>
    int main() {
    float C,F;
    printf("Enter Fahrenheit Value: ");
    scanf("%f", &F);
    C = (F-32)/1.8;
    printf("The Centigrade Value : %.2f \n", C);
    return 0; }

    Problem – 05

    The distance between Mirpur and Ashulia is input through the keyboard in meters. Write
    a program to convert and print this distance in feet, inches and centimeters.
    1 meter=100 cm
    1 meter=39.37 inch
    1 meter=3.21 feet
    #include <stdio.h>
    int main() {
    float distance, vulue_cm, vulue_inch, vulue_feet;
    printf("Enter The Distanc Mirpur and Ashulia at Meter: ");
    scanf("%f", &distance);
    vulue_cm = distance*100;
    vulue_inch = distance*39.37;
    vulue_feet = distance*3.21;
    printf("The Value at cm is: %.2f cm\n",vulue_cm );
    printf("The Value at inch is: %.2f inch\n",vulue_inch );
    printf("The Value at feet is: %.2f feet\n",vulue_feet );
    return 0; }

    Problem – 06

    Niloys basic salary is input through the keyboard. His dearness allowance is 40% of his
    basic salary and house rent is 20% of his basic salary. Write a program to calculate his
    gross salary.
    gross_salary=basic_salary+dearness_allowence+house_rent.
    #include <stdio.h>
    int main() {
    float salary, basic_salary, house_rant,total_sarary;
    printf("Enter Your Salary:  ");
    scanf("%f", &salary);
    basic_salary = salary*.2;
    house_rant = salary*.4;
    total_sarary = salary + basic_salary+house_rant;
    printf("Total Salary = %f",total_sarary);
    return 0; }
    

    Problem – 07

    If the marks obtained by a student in five different subjects are input through the keyboard,
    find out the aggregate marks and average marks obtained by the student.
    Assume that the maximum marks that can be obtained by a student in each subject is 100.
    #include <stdio.h>
    int main() {
    float sub1, sub2, sub3, sub4, sub5;
    printf("Enter marks for Subject 1: ");
    scanf("%f", &sub1);
    printf("Enter marks for Subject 2: ");
    scanf("%f", &sub2);
    printf("Enter marks for Subject 3: ");
    scanf("%f", &sub3);
    printf("Enter marks for Subject 4: ");
    scanf("%f", &sub4);
    printf("Enter marks for Subject 5: ");
    scanf("%f", &sub5);
    float aggregateMarks = sub1 + sub2 + sub3 + sub4 + sub5;
    float averageMarks = (float)aggregateMarks / 5;
    printf("Aggregate Marks: %.2f\n", aggregateMarks);
    printf("Average Marks: %.2f\n", averageMarks);
    return 0; }

    Problem – 08

    Printing a character with its ASCII value.
    #include <stdio.h>
    int main() {
    char ch;
    printf("Enter any character : ");
    scanf("%c", &ch);
    printf("The ASCII value is : %d \n",ch);
    return 0; }

    Problem – 09

    Beecrowd Problem 1001
    https://www.beecrowd.com.br/judge/en/problems/view/1001
    #include <stdio.h>
    int main() {
    int A, B, X;
    scanf("%d %d", &A,&B);
    X = A + B;
    printf("X = %d\n", X);
    return 0;}

    Problem – 10

    Beecrowd Problem 1002
    https://www.beecrowd.com.br/judge/en/problems/view/1002
    #include <stdio.h>
    int main() {
    double pi = 3.14159;
    double R, area;
    scanf("%lf", &R);
    area = pi * R * R;
    printf("A=%.4lf\n", area);
    return 0;}

    Topics-03 : Operator and Expression

    Problem – 01

    Find out the largest between three numbers using conditional operator.
    #include <stdio.h>
    int main() {
    int a, b;
    printf("Enter a Number: ");
    scanf("%d", &a);
    (a%2==0)? printf("Even"):printf("Odd");
    return 0; }

    Problem – 02

    Find out if a number is odd or even using Ternary operator.
    #include <stdio.h>
    int main() {
    int num1,num2,num3,largest;
    printf("Enter Three iInteger Number: ");
    scanf("%d %d %d",&num1,&num2,&num3);
    largest = (num1 > num2 && num1 > num3)? num1 : (num2 > num3)? num2 : num3;
    printf("The Largest number is : %d\n", largest);
    return 0; }

    Problem – 03

    Find out if the input is an alphabet using Ternary operator.
    #include <stdio.h>
    int main() {
    char ch;
    printf("Enter any character: ");
    scanf("%c", &ch);
    (ch>='a' && ch<='z') || (ch>='A' && ch<='Z') 
    ? printf("It is ALPHABET")
    : printf("It is NOT ALPHABET");
    return 0; }

    Problem – 04

    A computer manufacturing company has the following monthly compensation policy to the sales-person:
    Minimum base salary: 1500.00
    Bonus for every computer sold: 200.00
    Commission on the total monthly sales: 2%
    Write a program to calculate the gross salary for a sales person.
    You will take input the price of each computer and the number of sold during the month.
    #include <stdio.h>
    int main() {
    float salary, bonus, commission, price, sold, total_sarary;
    salary=1500.00;
    printf("Enter Each Computer Price: ");
    scanf("%f", &price);
    printf("Enter Total Computer Sold: ");
    scanf(“%f”, &sold);
    bonus = price*200;
    commission = price*sold*.2;
    total_sarary = salary + bonus + commission;
    printf("Total Salary = %f\n",total_sarary);
    return 0; }

    Problem – 05

    If the total selling price of 15 items and the total profit earned on
    them is input through the keyboard, write a program to find the cost price of one item.
    #include <stdio.h>
    int main () {
    float a, b, price;
    printf("Enter 15 item Price: ");
    scanf("%f", &a);
    printf("Enter 15 item Profit: ");
    scanf("%f", &b);
    price=(a-b)/15;
    printf("Cost of Each Product Price = %.2f", price);
    return 0; }

    Problem – 06

    Beecrowd Problem 1007
    https://www.beecrowd.com.br/judge/en/problems/view/1007
    #include <stdio.h>
    int main() {
    int A, B, C, D;
    int difference;
    scanf("%d %d %d %d", &A, &B, &C, &D);
    difference = (A * B) - (C * D);
    printf("DIFERENCA = %d\n", difference);
    return 0; }

    Problem – 07

    Beecrowd Problem 1008
    https://www.beecrowd.com.br/judge/en/problems/view/1004
    #include <stdio.h>
    int main () {
    int NUMBER,hours;
    float amount,SALARY;
    scanf("%d %d %f", &NUMBER, &hours, &amount);
    SALARY = hours * amount;
    printf("NUMBER = %d\n",NUMBER);
    printf("SALARY = U$ %0.2f\n", SALARY);
    return 0; }

    Topics-04 : Conditional Statement

    Problem – 01

    Write a C program to find out if a number is odd or even using conditional operator.
    #include <stdio.h>
    int main() {
    int num;
    printf ("Enter an integer: ");
    scanf("%d", &num);
    if(num % 2 == 0)
    printf("%d is an even number.", num);
    else
    printf("%d is a odd number.", num);
    return 0; }

    Problem – 02

    Write a C program to input a character from the user and
    check whether the given character is alphabet or not an alphabet using if else.
    #include <stdio.h>
    int main() {
    char ch;
    printf("Enter any character: ");
    scanf("%c", &ch);
    if ((ch>='a' && ch<='z') || (ch>='A' && ch<='Z'))
    printf("This is an ALPHABET\n");
    else 
    printf("This is NOT an ALPHABET\n");
    return 0; }

    Problem – 03

    Write a program to check whether a triangle is valid or not,
    when the three angles of the triangle are entered through the keyboard.
    A triangle is valid if the sum of all the three angles is equal to 180 degrees. 
    #include <stdio.h>
    int main() {
    float a, b, c;
    printf ("Enter three angles of any triangle: ");
    scanf("%f %f %f", &a, &b, &c);
    if(a+b+c==180)
    printf("This is a Triangle.");
    else
    printf("This is not a Triangle.");
    return 0; }

    Problem – 04

    Write a C program to check leap years using if else.
    #include<stdio.h>
    int main() {
    int year;
    printf("Enter any year: ");
    scanf("%d",&year);
    if(year%400==0){
    printf("It is a leap year = %d",year);
    } else if(year%4==0 && year%100!=0){
    printf("It is a leap year = %d",year);
    } else printf("It is not a leap year");
    return 0; }

    Problem – 05

    If the ages of Arif, Fahmid and Joy are input through the keyboard,
    write a program to determine the youngest of the three.
    #include <stdio.h>
    int main() {
    int alif, fahmid, joy;
    printf("Enter the age of Alif: ");
    scanf("%d", &alif);
    printf("Enter the age of Fahmid: ");
    scanf("%d", &fahmid);
    printf("Enter the age of Joy: ");
    scanf("%d", &joy);
    if (alif < fahmid && alif < joy)
    printf("Alif is the youngest person.\n");
    else if (fahmid < joy)
    printf("Fahmid is the youngest person.\n");
    else
    printf("Joy is the youngest person.\n");
    return 0; }

    Problem – 06

    Write a C program to input marks of five subjects Physics, Chemistry,
    Biology, Mathematics and Computer, calculate percentage and grade according to given conditions:
             If percentage >= 90% : Grade A
             If percentage >= 80% : Grade B
             If percentage >= 70% : Grade C
             If percentage >= 60% : Grade D
             If percentage >= 40% : Grade E
             If percentage < 40% : Grade F
    #include<stdio.h>
    int main(){
    float c, p, b, m, co, avr_marks;
    printf("Enter your chemistry marks: ");
    scanf("%f", &c);
    printf("Enter your physics marks: ");
    scanf("%f", &p);
    printf("Enter your biology marks: ");
    scanf("%f", &b);
    printf("Enter your mathematics marks: ");
    scanf("%f", &m);
    printf("Enter your computer marks: ");
    scanf("%f", &co);
    avr_marks = ((c+p+b+m+co)*100)/500;
    if(avr_marks >=90)
    printf("Grade A");
    else if(avr_marks >=80)
    printf("Grade B");
    else if(avr_marks >=70)
    printf("Grade C");
    else if(avr_marks >=60)
    printf("Grade D");
    else if(avr_marks >=40)
    printf("Grade E");
    else if(avr_marks <40)
    printf("Grade F");
    else
    printf ("Please Enter Your Subject Number.\n");
    return 0; }

    Problem – 07

    An electric power distribution company charges its domestic consumers as follows:
    Consumption Units Rate of Charge
    0 – 200 Rs. 0.50 per unit
    201 – 400 Rs. 100 plus Rs. 0.65 per unit excess of 200
    401 – 600 Rs. 230 plus Rs. 0.80 per unit excess of 400
    601 and above Rs. 390 plus Rs. 1.00 per unit excess of 600
    Write a program that reads the power consumed by
    a customer and prints the amount to be paid by the customer.
    #include <stdio.h>
    int main() {
    int cus;
    float units, bill;
    printf("Enter Customer Id Number: ");
    scanf("%d",&cus);
    printf("Enter Total Customer Units: ");
    scanf("%f", &units);
    if(units <= 200)
    bill = 0.50 * units;
    else if(units >= 201 && units <= 400)
    bill = 100 + 0.65 * (units - 200);
    else if(units >= 401 && units <= 600)
    bill = 230 + 0.80 * (units - 400);
    else 
    bill = 390 + 1.00 * (units - 600);
    printf("\n Customer Number = %d", cus);
    printf("\n Units consumed  = %.2f", units);
    printf("\n Bill = %.2f", bill);
    return 0; }

    Problem – 08

    Write a c program for +,-,*,/operation using switch case.
    #include <stdio.h>
    int main() {
    char operator;
    double a, b;
    printf("Enter Any Opearator (+, -, *, /) : ");
    scanf("%c", &operator);
    printf("Enter Your First Number: ");
    scanf("%lf", &a);
    printf("Enter Your Second Number: ");
    scanf("%lf", &b);
    switch (operator){
    case'+':
    printf("\nAddition : %.2lf + %.2lf = %.2lf", a, b, a+b);
    break;
    case'-':
    printf("\nSubstruction : %.2lf - %.2lf = %.2lf", a, b, a-b);
    break;
    case'*':
    printf("\nMultification : %.2lf * %.2lf = %.2lf", a, b, a*b);
    break;
    case'/':
    if(b==0) 
    printf("\nSecond value is 0. So, The divided value is undefine");
    else
    printf("\nDivided : %.2lf / %.2lf = %.2lf", a, b, a/b);
    break; }
    return 0; }
    

    Problem – 09

    Beecrowd Problem 1038
    https://www.beecrowd.com.br/judge/en/problems/view/1038
    #include <stdio.h>
    int main() {
    int X, Y;
    float price = 0;
    scanf("%d %d", &X, &Y);
    if (X == 1) {
    price = (float) (4.00 * Y); }
    else if (X == 2) {
    price = (float) (4.50 * Y); }
    else if (X == 3) {
    price = (float) (5.00 * Y); }
    else if (X == 4) {
    price = (float) (2.00 * Y); }
    else if (X == 5) {
    price = (float) (1.50 * Y); }
    printf("Total: R$ %.2f\n", price);
    return 0; }
    
    

    Problem – 10

    Beecrowd Problem 1044
    https://www.beecrowd.com.br/judge/en/problems/view/1044
    #include <stdio.h> 
    int main() { 
    int num_a, num_b; 
    scanf("%d %d", &num_a, &num_b); 
    if (num_b % num_a == 0 || num_a % num_b == 0) { 
    printf("Sao Multiplos\n"); 
    } else { 
    printf("Nao sao Multiplos\n"); }
    return 0; }
    
    

    Topics-05 : Loop

    Problem – 01

    BeeCrowd Problem: 1059
    https://www.beecrowd.com.br/judge/en/problems/view/1059
    #include <stdio.h>
    int main() {
    int i;
    for(i=2; i<=100; i=i+2) {
    printf("%d\n",i); }
    return 0; }

    Problem – 02

    WAP to sum up numbers in a range. (For example: from 1 to 10).
    #include <stdio.h>
    int main() {
    int a,sum=0;
    for (a =2; a<=10; a+=2) {
    sum += a; }
    printf("The sum of the even numbers from 1 to 10 is: %d \n", sum);
    return 0; }

    Problem – 03

    If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits. 
    #include <stdio.h>
    int main() {
    int number;
    int sum = 0;
    printf("Enter a five-digit number: ");
    scanf("%d", &number);
    if (number < 10000 || number > 99999) {
    printf("Invalid input. Please enter a five-digit number.\n"); }
    while (number > 0) {
    sum += number % 10;
    number /= 10; }
    printf("The sum of the digits of the entered number is: %d\n", sum);
    return 0; }

    Problem – 04

    A five-digit number is entered through the keyboard.
    Write a program to obtain the reversed number and to determine
    whether  the original and reversed numbers are equal or not.
    #include <stdio.h>
    int main( ) {
    int number, reverse=0, remainder, num;
    printf("Enter a 5 digit number: ");
    scanf("%d", &number);
    if (number < 10000 || number > 99999) {
    printf("Invalid input. Please enter a five-digit number.\n"); }
    num=number;
    while (num>0) {
    remainder=num%10;
    reverse=reverse*10+remainder;
    num=num/10;}
    printf("Reverse number is %d \n", reverse);
    if(number == reverse)
    printf("Reverse number is equal to actual number.\n");
    else
    printf("Reverse number is not equal to actual number.\n");
    return 0; }

    Problem – 05

    Write a program to find the factorial value of any number entered through the keyboard.
    #include <stdio.h> 
    int main(){
    int a, b = 1, num; 
    printf("Input the number : "); 
    scanf("%d", &num); 
    for(a = 1; a <= num; a++) 
    b = b * a;
    printf("The Factorial of %d is: %d\n", num, b); 
    return 0; }

    Problem – 06

    Write a program to print all prime numbers in a range.
    #include <stdio.h> 
    int main() {
    int num, a, b, start, end; 
    printf("Input starting number: ");
    scanf("%d", &start);
    printf("Input the ending number: ");
    scanf("%d", &end); 
    printf("The prime numbers between %d and %d are: \n", start, end);
    for (num = start; num <= end; num++) { 
    b = 0; 
    for (a = 2; a <= num / 2; a++) { 
    if (num % a == 0) { 
    b++; 
    break; } }
    if (b == 0 && num != 1) 
    printf("%d ", num); }
    printf("\n"); 
    return 0; }

    Problem – 07

    Check the following number prime or not by taking input from the user. 
    #include <stdio.h>
    int main() {
    int a, num, prime;
    prime = 1; 
    printf("Enter any number to check prime or not: ");
    scanf("%d", &num);
    for(a=2; a<=num/2; a++) {
    if(num%a==0) {
    prime = 0;
    break; } }
    if(prime == 1 && num > 1) {
    printf("\n%d is prime number", num); }
    else {
    printf("\n%d is composite number", num); }
    return 0; }

    Problem – 08

    Print Fibonacci series up to a certain number by taking input from the user.

    #include <stdio.h>
    int main() {
    int a, num;
    int b1 = 0, b2 = 1;
    int next = b1 + b2;
    printf("Enter the number of terms: ");
    scanf("%d", &num);
    printf("Fibonacci Series: %d, %d, ", b1, b2);
    for (a = 3; a <= num; ++a) {
    printf("%d, ", next);
    b1 = b2;
    b2 = next;
    next = b1 + b2;}
    return 0; }

    Problem – 09

    BeeCrowd Problem: 1060
    https://www.beecrowd.com.br/judge/en/problems/view/1060
    #include<stdio.h>
    int main() {
    float x;
    int i,sum=0;
    for(i=1;i<=6;i++){
    scanf("%f",&x);
    if(x>0){
    sum=sum+1; } }
    printf("%d valores positivos\n",sum);
    return 0; }

    Problem – 10

    Print the following pattern. 
         1 
         2 1 
         3 2 1
         4 3 2 1 
         5 4 3 2 1
    #include <stdio.h>
    int main() {
    int a,b;
    for (a = 1; a <= 5; a++) {
    for (int b = a; b >=1; b--) {
    printf(" %d ", b); }
    printf("\n"); }
    return 0; }
    
    

    Topics-06 : Array

    Problem – 01

    Print an array that outputs only the odd number from the array.
    #include <stdio.h>
    int main(){
    int a, b;
    printf("Enter your any array size: ");
    scanf("%d", &a);
    int nur[a];
    printf("Enter %d Numbers: ", a);
    for(b=0;b<a;b++){
    scanf("%d",&nur[b]);}
    printf("Odd Numbers in Array are: ");
    for(b=0;b<a;b++){
    if(nur[b]%2!=0)
    printf("%d ",nur[b]);}
    return 0;}

    Problem – 02

    Write a program to sum up the even elements of an array.
    #include <stdio.h>
    int main() {
    int a, b, sum=0;
    printf("Enter your any array size: ");
    scanf("%d", &a);
    int nur[a];
    printf("Enter %d Numbers: ", a);
    for(b=0; b<a; b++)
    scanf("%d", &nur[b]);
    for(b=0; b<a; b++) {
    if(nur[b]%2==0)
    sum=sum+nur[b]; }
    printf("Total Sum of Even values is: %d ",sum);
    return 0; }

    Problem – 03

    Write a program
    
    #include <stdio.h>
    int main() {
    int a, b, c, d;
    printf("Enter your any array size: ");
    scanf("%d", &a);
    int nur[a];
    printf("Enter %d Numbers: ", a);
    for(b=0; b=0;d-- ) {
    printf("%d ", nur[d]); }
    return 0; }
    

    Problem – 04

    Write a program
    #include <stdio.h>
    int main() {
    int a, b;
    printf("Enter your any array size: ");
    scanf(“%d”, &a);
    int nur[a];
    printf("Enter %d Numbers: ", a);
    for(b=0; b<a; b++){
    scanf("%d", &nur[b]);}
    printf("The maximum numbers are: ");
    int max = nur[0];
    for(b=1; b>max;) {
    max=nur[b];}
    printf("%d", max);
    return 0; }

    Thank You!

  • Probability Math Basic Concept

    Probability Math Basic Concept

    Random Experiment:

    An experiment in which all possible outcomes are known and the exact output cannot be predicted in advance is called a random
    experiment.

    Sample Space

    When we perform an experiment, then the set S of all possible outcomes is called the sample space.

    If we through a dice, the sample space
    S={1, 2, 3, 4, 5, 6}

    Event

    Any subset of a sample space is called an event. After tossing a coin, getting Head on the top is an event.
    Probability of an event

    •Let S be the sample and let E be an event.
    •Then E ⊆S
    •Probability of E for occurring, P(E)= ( n(E)) / (n(S) )
    •Here n(E) is the number of elements in E and n(s) is the number of elements in S.

    Probability Axioms
    •The probability of an event always varies from 0 to 1. [0≤P(x)≤1]
    •For an impossible event the probability is 0 and for a certain event the
    probability is 1.
    •If the occurrence of one event is not influenced by another event, they are called
    mutually exclusive or disjoint. If A1,A2….An are mutually exclusive/disjoint
    events, then
    P(A1∪A2∪….An)=P(A1)+P(A2)+…..P(An)
    Properties of Probability
    ● If there are two events x and x̅ which are complementary, then the
    probability of the complementary event is −
    p(x̅ )=1−p(x)
    A Standard Deck of Card
    Examples
    Example 1: What is the probability of drawing a king from a deck of cards?
    Solution 1:
    Here the event E is drawing a king from a deck of cards.
    There are 52 cards in a deck of cards.
    Hence, total number of outcomes = 52
    The number of favorable outcomes = 4 (as there are 4 kings in a deck)
    Hence, the probability of this event occurring is
    P(E) = 4/52 = 1/13
    Examples
    Example 2: Andy has drawn a card from a well-shuffled deck. Help her find the
    probability of the card either being red or a King.
    Solution 2:
    Jessica knows here that event E is the card drawn being either red or a King.
    The total number of outcomes = 52
    There are 26 red cards, and 4 cards which are Kings.
    However, 2 of the red cards are Kings.
    Examples
    If we add 26 and 4, we will be counting these two cards twice.
    Thus, the correct number of outcomes which are favorable to E is
    26 + 4 – 2 = 28
    Hence, the probability of event occurring is
    P(E) = 28/52 = 7/13
    Examples
    Example 3: Two cards are drawn from the pack of 52 cards. Find the probability
    that both are diamonds or both are kings.
    Solution 3:
    Total no. of ways = 52C2
    Case I: Both are diamonds = 13C2
    Case II: Both are kings = 4C2
    P (both are diamonds or both are kings) = (13C2 + 4C2 ) / 52C2
    Examples
    Example 4: A problem is given to three persons P, Q, R whose respective chances
    of solving it are 2/7, 4/7, 4/9 respectively. What is the probability that the
    problem is solved?
    Solution 4:
    Probability of the problem getting solved = 1 – (Probability of none of them
    solving the problem)
    Probability of problem getting solved = 1 – (5/7) x (3/7) x (5/9) = (122/147)
    Examples
    Example 5: There are 5 green 7 red balls. Two balls are selected one by one
    without replacement. Find the probability that first is green and second is red.
    Solution 5:
    P (G) × P (R) = (5/12) x (7/11) = 35/132
    Examples
    Example 6: Two cards are drawn from the pack of 52 cards. Find the probability
    that both are diamonds or both are kings.
    Solution 6:
    Total no. of ways = 52C2
    Case I: Both are diamonds = 13C2
    Case II: Both are kings = 4C2
    P (both are diamonds or both are kings) = (13C2 + 4C2 ) / 52C2
    Examples
    Example 7: Find the probability that a leap year has 52 Sundays.
    Solution 7:
    A leap year can have 52 Sundays or 53 Sundays. In a leap year, there are 366
    days out of which there are 52 complete weeks & remaining 2 days. Now,
    these two days can be (Sat, Sun) (Sun, Mon) (Mon, Tue) (Tue, Wed) (Wed,
    Thur) (Thur, Friday) (Friday, Sat).
    So there are total 7 cases out of which (Sat, Sun) (Sun, Mon) are two
    favorable cases. So, P (53 Sundays) = 2 / 7
    Examples
    Now, P(52 Sundays) + P(53 Sundays) = 1
    So, P (52 Sundays) = 1 – P(53 Sundays) = 1 – (2/7) = (5/7)

  • Complex Engineering Problem

    Complex Engineering Problem

    A Complex Engineering Problem (CEP) refers to a challenge or task in engineering that is characterized by the following features:

    1. Complexity of Scope

    • Involves multiple variables, interactions, or unknowns that require advanced knowledge and interdisciplinary approaches.
    • Examples include designing a self-driving car, developing renewable energy solutions, or creating systems for climate resilience.

    2. Uncertainty

    • Often involves incomplete or ambiguous information, requiring assumptions or predictions.
    • Solutions may need to adapt as new data or constraints emerge.

    3. High Level of Technical Knowledge

    • Demands a deep understanding of engineering principles, tools, and methodologies.
    • Often requires specialization in areas like thermodynamics, material science, or computational modeling.

    4. Interdisciplinary Nature

    • Draws from various domains like mechanical, electrical, software, or civil engineering.
    • Collaboration between experts from diverse fields is often necessary.

    5. Impact on Society and Environment

    • Addresses significant societal challenges, such as sustainable infrastructure, healthcare technology, or clean energy.
    • Involves ethical considerations and compliance with environmental or legal standards.

    6. Resource Constraints

    • Involves limitations like budget, time, manpower, or technology availability, requiring efficient planning and execution.

    7. Need for Innovation

    • Solutions often require creativity, innovation, and the development of new technologies or methodologies.
    • Involves prototyping, testing, and iterating solutions.

    8. Global Context

    • Often involves global challenges, such as climate change or urbanization, requiring solutions scalable across different regions or systems.

    Examples of Complex Engineering Problems:

    • Designing energy-efficient buildings that meet stringent environmental regulations.
    • Developing a high-speed rail system that integrates with existing infrastructure.
    • Addressing water scarcity using desalination and water recycling technologies.
    • Building a resilient power grid resistant to cyberattacks and natural disasters.
  • Selection Sort Algorithms

    Selection Sort Algorithm

    Selection Sort is a comparison-based sorting algorithm. It sorts an array by repeatedly selecting the smallest (or largest) element from the unsorted portion and swapping it with the first unsorted element. This process continues until the entire array is sorted.

    1. First we find the smallest element and swap it with the first element. This way we get the smallest element at its correct position.
    2. Then we find the smallest among remaining elements (or second smallest) and swap it with the second element.
    3. We keep doing this until we get all elements moved to correct position.
  • Quick Sort Algorithms

    Quick Sort Algorithm

    QuickSort is a sorting algorithm based on the Divide and Conquer that picks an element as a pivot and partitions the given array around the picked pivot by placing the pivot in its correct position in the sorted array.

    How does QuickSort Algorithm work?

    QuickSort works on the principle of divide and conquer, breaking down the problem into smaller sub-problems.

    There are mainly three steps in the algorithm:

    1. Choose a Pivot: Select an element from the array as the pivot. The choice of pivot can vary (e.g., first element, last element, random element, or median).
    2. Partition the Array: Rearrange the array around the pivot. After partitioning, all elements smaller than the pivot will be on its left, and all elements greater than the pivot will be on its right. The pivot is then in its correct position, and we obtain the index of the pivot.
    3. Recursively Call: Recursively apply the same process to the two partitioned sub-arrays (left and right of the pivot).
    4. Base Case: The recursion stops when there is only one element left in the sub-array, as a single element is already sorted.
  • Radix Sort Algorithms

    Radix Sort Algorithm

    Radix Sort is a linear sorting algorithm that sorts elements by processing them digit by digit. It is an efficient sorting algorithm for integers or strings with fixed-size keys.

    Rather than comparing elements directly, Radix Sort distributes the elements into buckets based on each digit’s value. By repeatedly sorting the elements by their significant digits, from the least significant to the most significant, Radix Sort achieves the final sorted order.

    Radix Sort Algorithm

    The key idea behind Radix Sort is to exploit the concept of place value. It assumes that sorting numbers digit by digit will eventually result in a fully sorted list. Radix Sort can be performed using different variations, such as Least Significant Digit (LSD) Radix Sort or Most Significant Digit (MSD) Radix Sort.

  • Insertion Sort Algorithms

    Insertion Sort Algorithm

    Insertion sort is a simple sorting algorithm that works by iteratively inserting each element of an unsorted list into its correct position in a sorted portion of the list. It is like sorting playing cards in your hands. You split the cards into two groups: the sorted cards and the unsorted cards. Then, you pick a card from the unsorted group and put it in the right place in the sorted group.

    • We start with second element of the array as first element in the array is assumed to be sorted.
    • Compare second element with the first element and check if the second element is smaller then swap them.
    • Move to the third element and compare it with the first two elements and put at its correct position
    • Repeat until the entire array is sorted.
  • Merge Sort Algorithms

    Merge Sort – Data Structure and Algorithms Tutorials

    Merge sort is a sorting algorithm that follows the divide-and-conquer approach. It works by recursively dividing the input array into smaller subarrays and sorting those subarrays then merging them back together to obtain the sorted array.

    In simple terms, we can say that the process of merge sort is to divide the array into two halves, sort each half, and then merge the sorted halves back together. This process is repeated until the entire array is sorted.