0% found this document useful (0 votes)
12 views2 pages

C Programming Answers

The document contains C programming code examples for three applications: a multiplication table generator, a simple invoice generation system, and a menu-driven calculator. Each example includes user input and output functionality, demonstrating basic programming concepts such as loops, conditionals, and arithmetic operations. These examples serve as practical applications for learning C programming.

Uploaded by

enndyfab2020
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

C Programming Answers

The document contains C programming code examples for three applications: a multiplication table generator, a simple invoice generation system, and a menu-driven calculator. Each example includes user input and output functionality, demonstrating basic programming concepts such as loops, conditionals, and arithmetic operations. These examples serve as practical applications for learning C programming.

Uploaded by

enndyfab2020
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

C Programming Guide - Answers

1. Multiplication Table Generator


```c
#include <stdio.h>
int main() {
int num, i;
printf("Enter a number: ");
scanf("%d", &num);
for(i = 1; i <= 10; i++) {
printf("%d x %d = %d\n", num, i, num * i);
}
return 0;
}
```

2. Simple Invoice Generation System


```c
#include <stdio.h>
int main() {
char item[20];
float price;
int quantity;
printf("Enter item name: ");
scanf("%s", item);
printf("Enter price: ");
scanf("%f", &price);
printf("Enter quantity: ");
scanf("%d", &quantity);
printf("\nInvoice:\nItem: %s\nQuantity: %d\nTotal Price: %.2f\n", item, quantity, price *
quantity);
return 0;
}
```

3. Menu-Driven Calculator
```c
#include <stdio.h>
int main() {
int choice;
float a, b;
do {
printf("1. Addition\n2. Subtraction\n3. Multiplication\n4. Division\n5. Exit\nChoose:
");
scanf("%d", &choice);
if (choice == 5) break;
printf("Enter two numbers: ");
scanf("%f %f", &a, &b);
switch(choice) {
case 1: printf("Result: %.2f\n", a + b); break;
case 2: printf("Result: %.2f\n", a - b); break;
case 3: printf("Result: %.2f\n", a * b); break;
case 4: printf("Result: %.2f\n", a / b); break;
default: printf("Invalid choice\n");
}
} while(choice != 5);
return 0;
}
```

You might also like