Project Work of Computer Science: Devi Secondary School, Anarmani-3 ESTD:2019

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 24

Project work of computer science

Devi Secondary School,Anarmani-3


ESTD:2019

Prepared by: Dal Bdr. Rajbanshi


Class: 12
Section: C
Faculty: Management
Submitted to: Nimesh Shiwakoti Sir
Date to submit: 2076/11/
11.// program to find odd or even number entered by the users.
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
printf(“Enter the number”);
scanf (“%d”,&n);
if(n%2==0)
printf(“%d is the even number”,n);
else
printf(“%d is the odd number”,n);
getch();
}
12.//program to display the name of the day on the basis of entered
number 1 to 7.
#include<stdio.h>
#include<conio.h>
void main()
{
int choice;
clrscr()
printf(“Enter the number of a day.”);
scanf(“%d”,&choice);
switch(choice)
{
case 1:
printf(“The day you have chosen is Sunday”);
break;
case 2:
printf(“The day you have chosen is Monday”);
break;
case 3:
printf(“The day you have chosen is Tuesday”);
break;
case 4:
printf(“The day you have chosen is Wednesday”);
break;
case 5:
printf(“The day you have chosen is Thursday”);
break;
case 6:
printf(“The day you have chosen is Friday”);
break;
case 7:
printf(“The day you have chosen is Saturday”);
break;
default:
printf(“Invalid options is given”);
}
getch();
}
13.//program to input a number and display its multiplication table .
# include<stdio.h>
# include<conio.h>
void main(0
{
int i,j,n;
printf(“Enter the number”);
scanf(“%d”,&n);
for(i=1;i<=10;i++)
{
j=n*i;
printf(“%d*%d=%d”,n,i,j);
printf(“\n”);
}
getch();
}
14.//program to read the salaries of 200 employees and count the number
of employee getting salaries from 5000 to 1000.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i, sal[50],count=0;
for (i=0;i<200;i++)
{
printf(“Enter the salaries”);
scanf(“%d”,&sal[i]);
}
for(i=0;i<200;i++)
{
if (sal[i]>=5000&&sal[i]<=10000)
{
count++;
}
}
printf(“Total salaries=%d”,count);
getch();
}
15.//program to display factorial using recursive function.
#include<stdio.h>
#include<conio.h>
int factorial (int);
void main()
{
int n,fact;
printf(“Input a number”);
scanf(“%d”,&n);
fact=factorial(n);
printf(“The factorial of %d is %d”,fact);
getch();
}
int factorial (int n)
{
if (n==0|n==1)
return 1;
else
return(n*factorial (n-1))
}
16.//program to input n number and sort them in ascending order.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,num[n],temp;
for(i=0;i<n;i++)
{
printf(“Enter the number”);
scanf(“%d”,&num[i]);
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(num[j]>num[j+i])
{
temp=num[j];
num[j]=num[j+i];
num[j+i]=temp;
}
}
}
printf(“sorted number in ascending order are :\n”);
for (i=0;i<n;i++)
{
printf(“%d\t”,num[i]);
}
getch();
}
17.//program to display the addition of two matrices.
#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][2],b[2][2],sum[2][2],I,j;
printf(“Enter the elements for matrix A:”);
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf(“Enter the number[%d][%d]:”,i,j);
scanf(“%d”,&a[i][j]);
}
}
printf(“Enter the elements for matrix B:\n”);
for(“i=0;i<2;i++)
{
for(“j=0;j<2;j++)
{
printf(“Enter the number[%d][%d]:”,i,j);
scanf(“%d”,&b[i][j]);
}
}
printf(“\nThe sum of the two matrix is :\n”);
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
sum[i][j]=a[i][j]+b[i][j];
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf(“%d\t”,sum[i][j]);
}
{
printf(“\n);
}
getch();
}
18.//program to calculate commission amount.
#include<stdio.h>
#include<conio.h>
Void main()
{
int s,a,r;
printf(“Enter sale amount”);
scanf(“%d”,&s);
if(s<=1000)
r=5;
else if(s<=2000)
r=10;
else
r=12;
a=(r/100)*5;
printf(“commission amount is %d”,a);
}
19.//Program to check whether the given number is prime or composite.
#include<stdio.h>
#include<conio.h>
Void main()
{
int n,i,count=0;
clrscr();
printf(“Input a number:”);
scanf(“%d”,&n);
for(i=1;i<=n;i++);
{
if (n%i==0)
{
count++;
}
}
if(count==2)
printf(“%d is prime”,n);
else
printf(“%d is composite”,n);
getch();

}
20.//program to read name, address, and age.
#include<stdio.h>
#include<conio.h>
struct person
{
char name[20]; char address[20];
int age;
};
void main()
{
struct person p[5];
int i;
for(i=0;i<5;i++)
{
printf(“Enter the name”);
scanf(“%s”,p[i].name);
printf(“Enter address of person”);
scanf(“%s”,p[i].address);
printf(“Enter age of person”);
scanf(“%d”,&p[i].age);
}
for(i=0;i<5;i++)
{
printf(“\n Name=%s\tAddress=%s\tAge =%d”,p[i].name,p[i].address,p[i].age);
}
getch();
}
21./*program to take n number of string and sort them in alphabetical
order.*/
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char str[50][30],temp[30];
int i,j,n;
printf(“Enter number of strings”);
scanf(“%d”,&n);
for (i=0;i<n;i++)
{
printf(“\nEnter the string”);
scanf(“%s”,str[i]);
}
for(i=0;i<n-1;i++);
{
if(strcmp(str[i],str[j])>0)
{
Strcpy(temp,str[i]);
Strcpy(str[i],str[j]);
Strcpy(str[j],temp);
}
}
printf(“The sorted string are:”);
for (i=0;i<n;i++)
{
printf(“\n%s”,str[i]);
}
getch();
}
Acknowledgement
I would like to express my special thanks of gratitude to my teacher
Mr. PRABAT THAPA as well as our principal MAM AMBIKA
SHRESTHA who gave me the golden opportunity to do this wonderful
project on the topic C PROGRAMMING, which also helped me in doing
a lot of Research and I came to know about so many new things.
I am really thankful to them.
Despite of my sincere effort to this report, there might be some mistake or
weakness. If there is any mistake regarding my project please pardon me.
I am making this project not only for marks but to also increase my
knowledge.
THANKS AGAIN TO ALL WHO HELPED ME
Content
1. Acknowledgement
2. Certificate from supervisor
3. Introduction of C Programming
4. Programming on the respective topic:
 Program to find odd or even.
 Program to find the commission amount.
 Program to display the name of day on the basis of entered
number 1 to 7.
 Program to input a number and display its multiplication
table.
 Program to read salaries of 200 employee.
 Program to add two matrices.
 Program to read name, address and age of 5 different person.
 Program to find the factorial of given number using recursive
function.
 Program to input ‘n’ number and sorting them in ascending
order.
 Program to calculate and display the factorial number of 5.
 Program to check whether the given number is prime or
composition.
 Program to display the multiplication table of n number using
function.
 Program that takes ‘n’ number of string and sorting them in
ascending order.
5. Conclusion
6. Bibliography
7. End page
Introduction on ‘C’ Language
Programming in C
Background
The computer needs a set of instructions to process data. A program is a
sequence of instructions to perform a particular task. Collection of the
program is called software.
A programming language is a well-defined set of rules for specifying a
program’s sequence of instruction.
Example: C, C++, FORTRAN, Java, BASIC, Prolog, Pascal etc.
The source code is a sequence of instruction, written in a human-readable
programming language. It constitutes a program or a piece of a program. A
source file is a file of source code.
Programming language
A language is a mean of communication. A programming language is a well-
defined set of rules for specifying a program sequence of instructions. A
programming language consists of symbols, characters, and rules that permit
people to communicate with computer.
Founder of C Language: Dennis Ritchie in 1970s.
Bibliography:
Following books and websites were a source for my project.

 Computer science book class XI & XII.


 www.google.com
 Practical note book of class XII.
 Mr. Parbat Thapa
 Mr. Nimesh Siwakoti
Conclusion:
As this is my first project I have ever done, so definitely there mightily
certain limitation and short coming in my project. I accept this fact and
later on in the future endeavors (attempt), I will try to develop better
project by using the experience of this project, knowledge and with the
knowledge of C PROGRAMMING in class XII.
The experience of building the project gave me a good platform to build
the real life program in the future.
Certificate from supervisor:
This is to certify that the project entitled “C Programming” submitted by
Mr. Dal Bahadur Rajbanshi to the department of computer science, Devi
Secondary school.
It is an original work carried out by him under my supervision and
guidance toward partial fulfillment of requirement for the award of
degree of grade XII.

Signature:………………. Signature:……………………..

Name: Mr. Nimesh Siwakoti Name:Mr.Parbat Thapa


Designation: Practical Teacher Designation:(Lecturer of computer-
-Science)

Devi secondary school,


Anarmani-3,Birtamod,Jhapa
(Affiliated to:- National Examination Board (NEB))

You might also like