Posts

C program for Household Expenditure Calculator

 Here's a simplified C program that calculates the expenditure of everyday life to run a house based on a monthly salary and a savings goal of 50%: Household Expenditure Calculator ``` #include <stdio.h> // Define structure for household expenses typedef struct {     float rent;     float utilities;     float groceries;     float transportation;     float entertainment;     float miscellaneous; } HouseholdExpenses; // Function to calculate total expenses float calculateTotalExpenses(HouseholdExpenses expenses) {     return expenses.rent + expenses.utilities + expenses.groceries + expenses.transportation + expenses.entertainment + expenses.miscellaneous; } // Function to calculate savings float calculateSavings(float salary) {     return salary * 0.5; } int main() {     float salary;     printf("Enter your monthly salary: ");     scanf("%f", &salary);    ...

C program that generates formulas for basic mathematics problems:

 Here's a simplified C program that generates formulas for basic mathematics problems: Mathematics Formula Generator ``` #include <stdio.h> #include <stdlib.h> #include <time.h> // Define structure for math problems typedef struct {     int num1;     int num2;     char operator;     float result; } MathProblem; // Function to generate a math problem MathProblem generateProblem() {     MathProblem problem;     problem.num1 = rand() % 100;     problem.num2 = rand() % 100;     int operatorIndex = rand() % 4;     switch (operatorIndex) {         case 0:             problem.operator = '+';             problem.result = problem.num1 + problem.num2;             break;         case 1:             problem.operator = '-';   ...