Technology has advanced to the point where programming has become an essential part of our lives. We use software and applications for communication, entertainment, education, and work, and these are all built on programming languages.

Program 3: Show addition, Subtraction, Multiplication, Division and Remainder of any two numbers

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a=6;
int b=5;
int c,d,e,f;
c=a+b;
d=a-b;
e=a*b;
f=a/b;
g=a%b;
printf("addition=%d",c);
printf("\nsubtraction=%d",d);
printf("\nmultiplication=%d",e);
printf("\ndivision=%d",f);
printf("\nremainder=%d",g);
getch();
}

Output
addition=11
subtraction=1
multiplication=30
division=1
remainder=1

Explanation
Here two numbers are assigned in varriable a and b and other varriables c,d,e,f and g are declared for storing the results of addition, subtraction, multiplication, division and remainder respectively. "%" is used to find remainder. "%d" is a specifier of integer.
Here "\n" is a specifier that is used to print the text in new line.


Exercise: 
Find out  simple interest where principal is 2000, time is 3 years and rate is 2% using a C program.

Share:

Impact Of Computer

Development of Technology has direct effect on our daily lives. This is the era of computer and everybody know how this has brought a major change in our livelihood. With the advance growth in technology since the early computers made in 1946 we have seen a quantam leap in changes made that has affected us both in our present lives and future. The computer has been considered as the greatest invention of 21st century whereas it is also blamed for many day-to-day problems and even tragic events.
Positive Impact of computer
  • The work can be done in very less time
  • More information can be stored in small space
  • Multitasking and  multiprocessing capability
  • Greater access to resources
  • Impartially
  • Documents can be kept secret
  • Error Free result
  •  Helps in scientific as well as for education research
  • etc
Negative Impact of Computer
  • Highly Expensive
  • Increased Unemployment
  • Data Piracy
  • Computer/Cyber Cribe
  • No age restriction on pronography
  • People can make a negative research on computer
  • Effect on health 
  • etc
Share:

Program 2- Program to add two numbers

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a=5;
int b=7;
int c;
c=a+b;
printf("Addition=%d", c);
getch();
}




Output
Addition=12



Explanation
int denotes that variable a can store only integer number so number 5 is provided to it. Varriable c is declared as integer and addition of the number a and b is now placed to c for mathematical calculation. Now to print the result, we have given %d as specifier of interger that holds the value of c.


Exercise:
Make a program that add 3 numbers.
Share:

Program 1- To Print "Welcome To Bit"

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("Welcome To Bit");
getch();
}






Output
Welcome To Bit








Explanation: #include<stdio.h> and #include<conio.h> is a header file and should be written in the same manner, beginning with #include and written in angular bracket "<" , ">". Here stdio.h defines printf to perform its function and conio.h defines a compiler inorder to translate C program to machine language program.


Exercise:

Write a program to print "Welcome To Bit" five times.
 hint: just use printf("Welcome to Bit") for five times in the block of C program.


 
Share:

Translate

Wikipedia

Search results