Professional Documents
Culture Documents
Micro-Project
On
CERTIFICATE
Seal Of
Institution
ABSTRACT:
PROBLEM STATEMENT:
A simple calculator program in C which will perform basic arithmetic
operations like addition, subtraction, multiplication, division, and remainder depending
on the input from the user. Users will have the choice to choose the operation. If the
user chooses the wrong operation then he/she will get an error message. It is a very
effective and simple understanding of beginners.
• Software used :-
Turbo C
➢ Introduction To C
C is a general-purpose high-level language that was originally developed by Dennis
Ritchie for the Unix operating system. It was first implemented on the Digital
Equipment Corporation PDP-11 computer in 1972.
The Unix operating system and virtually all Unix applications are written in the C
language. C has now become a widely used professional language for various reasons.
• Easy to learn
• Structured language
• It produces efficient programs.
• It can handle low-level activities.
• It can be compiled on a variety of computers.
➢ History Of C Language
Operating Systems:-
The first operating system to be developed using a high-level programming language
was UNIX, which was designed in the C programming language. Later on, Microsoft
Windows and various Android applications were scripted in C.
➢ Embedded Systems
➢ Gui
GUI stands for Graphical User Interface. Adobe Photoshop, one of the most
popularly used photo editors since olden times, was created with the help of C.
Later on, Adobe Premiere and Illustrator were also created using C.
1. Simple
2. Machine Independent or Portable
3. Mid-level programming language
4. structured programming language
5. Rich Library
6. Memory Management
7. Fast Speed
8. Pointers
9. Recursion
10. Extensible
1. Easy to learn: C is a very easy to learn middle level language for expressing ideas in
programming in a way that most people are comfortable with.
1. Concept of OOP: C s is a very vast language, but it does not support the concept of
OOPs (Inheritance, Polymorphism, Encapsulation, Abstraction, Data Hiding). C
simply follows the procedural programming approach.
2. Run-time checking In: the C programming language, the errors or the bugs aren’t
detected after each line of code. Instead, the compiler shows all the errors after writing
the program. It makes the checking of code very complex in large programs.
3. Concept of namespace: C does not implement the concept of namespaces. A
namespace is structured as a chain of commands to allow the reuse of names in
different contexts. Without namespaces, we cannot declare two variables of the same
name. But, C programming lacks in this feature, and hence you cannot define a
variable with the same name in C.
4. Lack of Exception Handling: Exception Handling is one of the most important
features of programming languages. While compiling the code, various anomalies and
bugs can occur. Exception Handling allows you to catch the error and take appropriate
responses. However, C does not exhibit this important feature.
5. Constructor or destructor: C does not have any constructor or destructor.
Constructors& Destructors support basic functionality of Object-Oriented
Programming. Both are member functions that are created as soon as an object of the
class is created. You will be studying constructor and destructor in detail later on.
6. Low level of abstraction: C is a small and core machine language that has minimum
data hiding and exclusive visibility that affects the security of this language.
#include <stdio.h>
int main()
{
int a[2] [2], b[2] [2], c[2] [2];
int i,j,n1,n2,ch,ch1,ch2;
clrscr();
printf("\nEnter your choice:");
printf("\n1.Matrix calculation\n2.Simple calculation");
scanf("%d",&ch);
switch (ch)
{
case 1 :
do
{
printf("\nMatrix calculations:");
printf("\n****MENU****");
printf("\n1.addition\n 2.substraction\n 3.multiplication\n 4.division\n 5.Exit");
printf("\n Enter Choice");
scanf("%d",&ch1);
printf("Enter value of first matrix");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
switch(ch1)
{
case 1: printf("Addition=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c [i] [j] = a[i] [j] + b[i] [j];
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t", c[i] [j]);
}
printf("\n");
}
break;
case 3: printf("Multiplication=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c [i] [j] = a[i] [j] * b[i] [j];
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t", c[i] [j]);
}
printf("\n");
}
PCI MICROPROJECT BY GROUP NO.4
break;
case 4: printf("Division=\n");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
c [i] [j] = a[i] [j] / b[i] [j];
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d\t", c[i] [j]);
}
printf("\n");
}
break;
case 2 :
printf("Simple Calculatios:");
printf("\n***MENU***");
printf("\n1.Addition\n2.Substraction\n3.Multiplication\n4.Division");
printf("\nEnter your choice:");
scanf("%d",&ch2);
if(ch2>=1 && ch<=4)
PCI MICROPROJECT BY GROUP NO.4
{
printf("\nEnter two values:");
scanf("%d %d",&n1,&n2);
}
switch(ch2)
{
case 1 : printf("\nAddition=%d",n1+n2);
break;
case 2 : printf("\nSubstraction=%d",n1-n2);
break;
case 3 : printf("\nmultiplication=%d",n1*n2);
break;
case 4 : printf("\ndivision=%d",n1/n2);
break;
default : printf("\nEnter correct choice");
}
}
getch();
return 0;
}
REFERENCE:
➢ https://www.javatpoint.com/calculator-program-in-c
➢ https://www.programiz.com
➢ https://www.tutorialgateway.org