JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
22 days ago3 views
👨‍💻Programming
Question 1:
#include <stdio.h>
int main() {
    int num1, num2;
    
    printf("Enter two numbers: ");
    scanf("%d %d", &num1, &num2) ;   
    printf("Sum = %d\n", num1 + num2);
    printf("Product = %d\n", num1 * num2);
    printf("Difference = %d\n", num1 - num2);
    printf("Quotient = %d\n", num1 / num2);
    printf("Remainder = %d\n", num1 % num2);
    
    return 0;
}
Question 2:
#include <stdio.h>
int main() {
    int a, b, c;
    int sum, product, average;
    int smallest, largest;
    
    printf("Enter three different integers: ");
    scanf("%d %d %d", &a, &b, &c);
    
    sum = a + b + c;
    product = a  b  c;
    average = sum / 3;
   
    smallest = a;
    if (b < smallest)
        smallest = b;
    if (c < smallest)
        smallest = c;
    
    largest = a;
    if (b > largest)
        largest = b;
    if (c > largest)
        largest = c;
    
    printf("Sum is %d\n", sum);
    printf("Average is %d\n", average);
    printf("Product is %d\n", product);
    printf("Smallest is %d\n", smallest);
    printf("Largest is %d\n", largest);
    
    return 0;
}
Question:3
/*without loop*/
#include <stdio.h>
int main()
{
    printf("*********     ***       *        *\n");
    printf("*       *    *   *     ***      * *\n");
    printf("*       *   *     *   *****    *   *\n");
    printf("*       *   *     *     *     *     *\n");
    printf("*       *   *     *     *      *   *\n");
    printf("*       *    *   *      *       * *\n");
    printf("*********     ***       *        *\n");
    return 0;
}
/*with loop*/
#include <stdio.h>
int main()
{
    char *shape[] = {
        "*********     ***       *        *",
        "*       *    *   *     ***      * *",
        "*       *   *     *   *****    *   *",
        "*       *   *     *     *     *     *",
        "*       *   *     *     *      *   *",
        "*       *    *   *      *       * *",
        "*********     ***       *        *"
    };
    int i;
    for(i = 0; i < 7; i++)
    {
        printf("%s\n", shape[i]);
    }
    return 0;
}
Question 4:
#include <stdio.h>
int main()
{
    int number;
    int digit1, digit2, digit3, digit4, digit5;
    printf("Enter a five-digit number: ");
    scanf("%d", &number);
    digit5 = number % 10;
    number = number / 10;
    digit4 = number % 10;
    number = number / 10;
    digit3 = number % 10;
    number = number / 10;
    digit2 = number % 10;
    number = number / 10;
    digit1 = number % 10;
    printf("%d   %d   %d   %d   %d\n",
           digit1, digit2, digit3, digit4, digit5);
    return 0;
}
Question5:
#include <stdio.h>
int main()
{
    printf("Number\tSquare\tCube\n");
    printf("0\t0\t0\n");
    printf("1\t1\t1\n");
    printf("2\t4\t8\n");
    printf("3\t9\t27\n");
    printf("4\t16\t64\n");
    printf("5\t25\t125\n");
    printf("6\t36\t216\n");
    printf("7\t49\t343\n");
    printf("8\t64\t512\n");
    printf("9\t81\t729\n");
    printf("10\t100\t1000\n");
    return 0;
}
Prepared By:
Monjed Ahmed Nagi Mohammed
Submitted To:
Dr. Mahmoud Aburub
Course:
Introduction to C Programming

⚠️Content was pasted as plain text and auto-formatted as a code block. Use the Code Block button in the editor for proper formatting.

← Back to timeline