Skip to content
Programmingoneonone
Programmingoneonone
  • Engineering Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
    • 100+ C++ Programs
  • Solutions
    • HackerRank
      • Algorithms Solutions
      • C solutions
      • C++ solutions
      • Java solutions
      • Python solutions
    • Leetcode Solutions
    • HackerEarth Solutions
  • Work with US
Programmingoneonone
Programmingoneonone

C program for production and sales analysis

YASH PAL, 31 July 202419 February 2026

In this tutorial, we are going to write a C Program for production and sales analysis in C Programming with practical program code and step-by-step full complete explanation.

C Program for production and sales analysis

C Program for production and sales analysis.

 
#include<stdio.h>
#include<conio.h>

void main()
{
    int M[5][6], S[5][6], C[6], Mvalue[5][6], Svalue[5][6], Mweek[5], Sweek[5], Mproduct[6], Sproduct[6], Mtotal, Stotal, i, j, number;

    printf("Enter products manufactured week wise");
    printf("M11, M12,-,M21,M22,-etc");

    for(i=1;i<=4;i++)
        for(j=1;j<=5;j++)
            scanf("%d",&M[i][j]);

    printf("Enter products sold week wise");
    printf("S11,S12,-,S21,S22,-etc");

    for(i=1;i<=4;i++)
        for(j=1;j<=5;j++)
            scanf("%d",&S[i][j]);

    printf("Enter the cost of each product");

    for(j=1;j<=5;j++)
        scanf("%d",&C[j]);

    for(i=1;i<=4;i++)
        for(j=1;j<=5;j++)
        {
            Mvalue[i][j]=M[i][j]*C[j];
            Svalue[i][j]=S[i][j]*C[j];
        }
        for(i=1;i<=4;i++)
        {
            Mweek[i]=0;
            Sweek[i]=0;
            for(j=1;j<5;j++)
            {
                Mweek[i] += Mvalue[i][j];
                Sweek[i]+= Svalue[i][j];
            }
        }
        for(j=1;j<=5;j++)
        {
            Mproduct[j]=0;
            Sproduct[j]=0;

            for(i=1;i<=4;i++)
            {
                Mproduct[i] += Mvalue[i][j];
                Sproduct[i] += Svalue[i][j];
            }
        }

        Mtotal=Stotal=0;

        for(i=1;i<=4;i++)
        {
            Mtotal+=Mweek[i];
            Stotal+=Sweek[i];
        }

        printf("nn");
        printf("Following is the list of things you cann");
        printf("request for enter appropriate item number and press RETURN keyn");
        printf("1. Value matrices of production & salesn");
        printf("2. Total value of weekly production & salesn");
        printf("3. Product-wise montly value of production & salesn");
        printf("4. Grand total value of production & salesn");
        printf("5. Exitn");

        number=0;

        while(1)
        {
            printf("ENTER YOUR CHOICE:");
            scanf("%d", &number);
            printf("n");

            if(number==5)
            {
                printf("GOOD BYE");
                break;
            }

            switch(number)
            {
                case 1:
                printf("VALUE MATRIX OF PRODUCTIONn");
                for(i=1;i<=4;i++)
                {
                    printf("Week (%d)",i);
                    for(j=1;j<=5;j++)
                        printf("%7d",Mvalue[i][j]);
                    printf("n");
                }
                printf("VALUE MATRIX OF SALESn");
                for(i=1;i<=4;i++)
                {
                    printf("Week(%d)",i);
                    for(j=1;j<=5;j++)
                        printf("%7d",Svalue[i][j]);
                    printf("n");
                }
                break;

                case 2:
                printf("TOTAL WEEKLY PRODUCTION & SALESn");
                printf("             PRODUCTION SALESn");
                printf("            ---------- ----     n");

                for(i=1;i<=4;i++)
                {
                    printf("Week(%d)",i);
                    printf("%7d%7d",Mweek[i],Sweek[i]);
                }
                break;

                case 3:
                printf("PRODUCT WISE TOTAL PRODUCTION & SALESn");
                printf("             PRODUCTION SALESn");
                printf("              ------------   ------  n");

                for(j=1;j<=5;j++)
                {
                    printf("Product(%d)n",j);
                    printf("%7d%7d",Mproduct[j],Sproduct[j]);
                }
                break;

                case 4:
                printf("GRAND TOTAL OF PRODUCTION SALESn");
                printf("Total production=%dn",Mtotal);
                break;

                default:
                printf("Wrong choice, select gainn");
                break;
            }
        }
        printf("Exit from the program");
}

Output

 
Enter products manufactured week wise
M11,M12,----M21,M22,----etc
11  15      12  14      13
13  13      14  15      12
12  16      10  15      14
14  11      15  13      12

Enter products sold week wise
S11, S12, --- S21, S22, --- etc
10   13       9    12    11
12   10       12   14    10
11   14       10   14    12
12   10       13   11    10

Enter cost of each product
10 20 30 15 25

Following is the list of things you can request for enter appropriate item nuber and press RETURN key
1. Value matrices of production & sales
2. Total value of weekly production & sales
3. Product-wise montly value of production & sales
4. Grand total value of production & sales
5. Exit

Enter your choice: 1
VALUE MATRIX OF PRODUCTION
Week(1) 110 300 360 210 325
Week(2) 130 260 420 225 300
Week(3) 120 320 300 225 350
Week(4) 140 220 450 210 300

VALUE MATRIX OF SALES
Week(1) 100 260 270 180 275
Week(2) 120 200 360 210 250
Week(3) 110 280 300 210 300
Week(4) 120 200 390 165 250

Enter your choice: 2
TOTAL WEEKLY PRODUCTION & SALES

        PRODUCTION     SALES
        ----------    -------
Week(1)  1305          1085
Week(2)  1335          1140
Week(3)  1305          1200
Week(4)  1315          1125

Enter your choice: 3
PRODUCT WISE TOTAL PRODUCTION & SALE
            PRODUCTION    SALES
            ----------    -----
Product(1)    500         450
Product(2)    1100        450
Product(3)    1530        450
Product(4)    855         450
Product(5)    1275        1075

Enter your choice: 4
GRAND TOTAL OF PRODUCTION SALES
Total production=5260
Total sales=4550
ENTER YOUR CHOICE: 5
GOOD BYE
Exit from the program
c coding problems solutions cC ProgramPrograms

Post navigation

Previous post
Next post

Leave a Reply

Your email address will not be published. Required fields are marked *

The First C Program
Reading Input in a C Program
Compiling C Programs
C Program to read a number and print the factorial
C Program to Print the Sum of N Natural Numbers
C Program to Print Factorial of any Given Number
C Program to Check a Prime Number or Not
C Program to Print the Power of a Given Number
C Program to Print Factors of a Given Number
C Program to Print Factorial using Recursion
C Program to find gross salary
C Program to Reverse a Given Number
C Program to Swap Two Numbers without Using a Third Variable
C Program to Calculate the sum of subjects and find the percentage
C Program to convert temperature from centigrade to Fahrenheit
C Program to find simple interest
C Program to find the area and circumference of a circle
C Program to find the sum of two numbers
C Program to find the sum of two matrices
C Program to find even/odd numbers
C Program to display a matrix
C Program to show the use of the conditional operator
C Program to find the maximum number in an array
C Program to find the greatest of 3 Numbers
C Program to show the sum and average of 10 elements of an array
C Program to print a table of any number
C Program to add two numbers using pointers
C Program to use the bitwise AND operator between the two integers
C Program to display an odd number series and find the sum
C Program to display the sum of the harmonic series
C Program to print the Fibonacci series up to 100
C Program to print a star pattern in a pyramid shape
C Program to print a star pattern in a reverse triangle shape
C Program to print a star pattern in a triangle shape
C Program to display the first 10 natural numbers and their sum
C Program to display arithmetic operations using a switch case
C Program to display weekdays using a switch statement
C Program to find the subtraction of two matrices
C Program to shift input data by two bits to the left
C Program to find occurrences of vowels, consonants, words, spaces and special characters in give sentence
C Program to merge two arrays, excluding the repeating elements
C Program to perform file operations
C Program to find a palindrome number
C Program to find the largest of two numbers using the function
C Program to show call by reference
C Program to show call by value
C Program to show a table of numbers using a function
C Program to find the factorial of a number using a function
C Program to swap two numbers using a function
C Program to find the square of a number using a function
C Program to show input and output of a string
C Program to print the powers of 2 tables for the powers 0 to 20
C Program to find the maximum number in an array using a pointer
C Program to print the multiplication table
C Program to find the transpose of a matrix
C Program to evaluate the equation y=xn
C Program to find the multiplication of two matrices
C Program to display months using enum
C Program for finding the largest number in an array
C Program for sorting the elements of an array in descending order
C Program to count the number of students in each group
C Program to evaluate a square expression and its sum
C Program for plotting of two functions
C Program of minimum cost problem
C Program to draw a histogram
C Program to print a binomial coefficient table
C Program to read a line of text
C Program to illustrate the use of the continue statement
C Program to read a string using the scanf() function
C Program to evaluate the geometric progression series
C Program for production and sales analysis
C Program to illustrate the use of the break statement
C Program to evaluate response to a multiple-choice test
C Program to print the total marks obtained by a student
C Program to calculate standard deviation
C Program to sort a list of numbers and to determine the median
C Program for finding the desired kth smallest element in an array
C Program for removing duplicate elements in an array
C Program to use functions with no arguments and no return values
C Program to sort a customer list in the alphabetical list
C Program for counting characters, words, and lines in a text
C Program to sort a list of names in alphabetical order
C Program to calculate the square and cube by using a function as an argument
C Program to use string handling functions
C Program to return only absolute values
C Program to concatenate a string
C Program to pass arguments to a user-defined function by value/reference
C Program to print the Character and Decimal value of alphabet
C Program to return more than one value from a user-defined function
C Program to count the number of characters copied into a string
C Program to show the use of user defined function
C Program to use global variables on different functions
C Program to use similar variables in different functions
C Program to define & call user-defined functions
C Program to call a user-defined function
C Program to find the power of a value using a function
C Program to use functions with arguments and return values
C Program to use functions with arguments but no return values
C Program to use the ++ operator with the return value of a function
C Program to perform multiplication and division of numbers
C Program to perform addition and subtraction of numbers
C Program to assign the return value of a function to another variable
C Program to call the function through a for loop
C Program to call the user-defined function through the switch() statement
C Program to call the user-defined function through an if statement
C Program to evaluate the function equation s = sqr(a() + b())
C Program to use modulo % with a function
Student marksheet program in C programming

Programmingoneonone

We at Programmingoneonone, also known as Programming101 is a learning hub of programming and other related stuff. We provide free learning tutorials/articles related to programming and other technical stuff to people who are eager to learn about it.

Pages

  • About US
  • Contact US
  • Privacy Policy

Practice

  • Java
  • C++
  • C

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes