Powered By Blogger

Feb 11, 2025

10. Armstrong Number Check

 #include <stdio.h>

#include <math.h>

int main() {

    int num, original, remainder, n = 0, result = 0;

    printf("Enter a number: ");

    scanf("%d", &num);

    original = num;

    while (original != 0) {

        original /= 10;

        ++n;

    }

    original = num;

    while (original != 0) {

        remainder = original % 10;

        result += pow(remainder, n);

        original /= 10;

    }

    if (result == num)

        printf("Armstrong Number\n");

    else

        printf("Not an Armstrong Number\n");

    return 0;

}


9. Sum of Digits

 #include <stdio.h>

int main() {

    int num, sum = 0, rem;

    printf("Enter a number: ");

    scanf("%d", &num);

    while(num != 0) {

        rem = num % 10;

        sum += rem;

        num /= 10;

    }

    printf("Sum of digits: %d\n", sum);

    return 0;

}


8. Swapping Two Numbers (Without Temp Variable)

 #include <stdio.h>

int main() {

    int a, b;

    printf("Enter two numbers: ");

    scanf("%d %d", &a, &b);

    a = a + b;

    b = a - b;

    a = a - b;

    printf("After swapping: a = %d, b = %d\n", a, b);

    return 0;

}


7. Fibonacci Series

 #include <stdio.h>

int main() {

    int n, t1 = 0, t2 = 1, next;

    printf("Enter the number of terms: ");

    scanf("%d", &n);

    for (int i = 1; i <= n; ++i) {

        printf("%d ", t1);

        next = t1 + t2;

        t1 = t2;

        t2 = next;

    }

    printf("\n");

    return 0;

}


6. Reverse a Number

 #include <stdio.h>

int main() {

    int num, rev = 0, rem;

    printf("Enter a number: ");

    scanf("%d", &num);

    while(num != 0) {

        rem = num % 10;

        rev = rev * 10 + rem;

        num /= 10;

    }

    printf("Reversed: %d\n", rev);

    return 0;

}


5. Prime Number Check

 #include <stdio.h>

int main() {

    int n, i, flag = 1;

    printf("Enter a number: ");

    scanf("%d", &n);

    if (n < 2)

        flag = 0;

    for(i = 2; i * i <= n; ++i)

        if(n % i == 0) {

            flag = 0;

            break;

        }

    if (flag)

        printf("Prime\n");

    else

        printf("Not Prime\n");

    return 0;

}


4. Factorial of a Number

 #include <stdio.h>

int main() {

    int n, i;

    unsigned long long fact = 1;

    printf("Enter a number: ");

    scanf("%d", &n);

    for(i = 1; i <= n; ++i)

        fact *= i;

    printf("Factorial: %llu\n", fact);

    return 0;

}


3. Even or Odd



#include <stdio.h> int main() { int num; printf("Enter an integer: "); scanf("%d", &num); if (num % 2 == 0) printf("Even\n"); else printf("Odd\n"); return 0; }

2. Addition of Two Numbers

 #include <stdio.h>

int main() {

    int a, b, sum;

    printf("Enter two numbers: ");

    scanf("%d %d", &a, &b);

    sum = a + b;

    printf("Sum: %d\n", sum);

    return 0;

}


1. Hello World

 

#include <stdio.h>

int main() {

    printf("Hello, World!\n");

    return 0;

}


Nov 13, 2024

OS Syllabus

 

Introduction to Operating Systems

  1. Definition, Objectives, and Core Functions of an Operating System – Overview of OS purposes and essential functions
  2. System Calls and System Services – Explanation of system calls (e.g., process control, file operations) and system services
  3. Structures of Operating Systems – Explanation of any two OS structures (e.g., Monolithic, Microkernel, Layered)

Processes and Scheduling

  1. Process Control Block (PCB) – Explanation with a diagram highlighting components like process ID, state, CPU registers
  2. SJF (Shortest Job First) CPU Scheduling – Calculation of average turnaround and response times for given process data
  3. Process Definition and State Diagram – Detailed explanation of process states (New, Ready, Running, Waiting, Terminated)

Concurrency and Synchronization

  1. Critical Section Problem – Explanation with an example (e.g., shared resource access in a multi-threaded environment)
  2. Monitor in Synchronization – Explanation of monitors and example of their use in synchronizing access to shared resources
  3. Semaphore and Producer-Consumer Problem – Definition of semaphore and example of solving producer-consumer synchronization

Memory Management

  1. Contiguous Memory Management Techniques – Explanation of fixed and variable partitioning, and their pros and cons
  2. Page Fault and Handling Process – Definition of a page fault and steps involved in handling it
  3. Internal vs. External Fragmentation – Explanation of fragmentation types in

Disk and File Management

  1. File Allocation Methods – Brief overview of contiguous, linked, and indexed file allocation methods with examples
  2. Direct Memory Access (DMA) – Explanation of how DMA improves system efficiency by reducing CPU load
  3. FCFS vs. SSTF Disk Scheduling – Comparison of First-Come, First-Served and

Linux Operating System

  1. fork() vs. clone() System Calls in Linux – Comparison of system calls for process and thread creation
  2. Inter-Process Communication (IPC) in Linux – Explanation of IPC mechanisms like pipes, message queues, and shared memory
  3. Design Principles of Linux OS – Overview of Linux's core design principles like modularity, security, and efficiency

Featured Post

Data Analysis

    What is data analysis and its significance?   Data analysis is the process of collecting, transforming, and organizing data to dr...

Popular Posts