Ashim Final
Ashim Final
Ashim Final
(COMPUTER SCIENCE)
GRADE: XI J1 Science
KATHMANDU, NEPAL
2023
ACKNOWLEDGEMENT
I would like to express my deep appreciation and gratitude to my subject teacher and lecturer
Mr. Sanjog Sir for their coinstantaneous help, advice, information and encouragement in this
project
I feel immense pleasure to present my project after a long work. Besides my effort, the help
and guideline given by many others hasn’t been unnoticed. I express my gratitude to all those
countless people for the support for me in doing this project.
I express my thanks to Uniglobe Secondary School / College for it has been a source of the
creation of this project and the support, valuable information, resources and guidance give to
me to do this project.
I am also grateful and indebt of my beloved friends for their immeasurable help, support and
encouragement from the beginning to the
End of the project without whom this project would not have been a reality.
Last but not the least I would like to thank my parents, family members, friends, this College
and other who help me for their guidance
And support.
Ashim Siwakoti
Objective
Objective is a specific result that a person, a system aims to achieve within a time
frame and with avid able resources. In general, objectives are more specific and
easier to measure than goals. Objectives are basic tools that underline all
planning and strategic activities. They serve as a basic forecasting policy and
evaluating performance.
I) ‘for’ loop
Example:
#include<stdio.h>
Void main()
int i, fact=1;
for(i=1;i<=5;i++)
fact=fact*i;
Example:
#include<stdio.h>
Void main()
Example:
#include<stdio.h>
void main()
{
/* program to display multiplication table of 5 */
int i=1; //initialization
int p;
do
{
p=5*i;
printf(“\n6*%d = %d”,I,p);
i++; //increment
} while(i<=10); //condition
}
Q5. What is array? Explain different types of array.
- An array is a collection of similar types of data items treated as a single
unit. It acts to store related data under the same name with an index, also
known as a subscript which helps to access individual array element.
- There are two types of arrays which are as follows:
#include<stdio.h>
#include<string.h>
void main()
{
char str[49];
printf(“Enter a string:”);
gets(str);
printf(“The string in lower-case is: %s”,strlwr(str));
strupr()- To convert lower case characters of strings into upper case characters.
Example:
#include<stdio.h>
#include<string.h>
void main()
{
char str[49];
printf(“Enter a string:”);
gets(str);
printf(“The string in lower-case is: %s”,strupr(str));
strlen()- To return the length of a string which takes the string name as an
argument.
Example:
#include<stdio.h>
#include<string.h>
void main()
{
char str[50];
int l;
printf(“Enter a string:”);
gets(str);
l=strlen(str);
printf(“The length of the string is: %d”, l);
}
strcat()- To join or concatenate one string into other string. It takes two strings
and second string is concatenated over first string.
Example:
#include<stdio.h>
#include<string.h>
void main()
{
char str1[50],str2[60];
Example:
#include<stdio.h>
#include<string.h>
void main()
{
char str;
printf(“Enter the string:”);
gets(str);
strrev(str);
printf(“The reverse of given string is %s, str);
}
}
strcpy()- To copy one string into another string.
Example:
#include<stdio.h>
#include<string.h>
void main()
{
char str1[50],str2[50];
printf(“Enter first string:”);
gets(str1);
strcpy(str2,str1);
printf(“After copying the string is %s.”,str2);
}
Q8. Write differences between for loop and while loop
-
Q9. Write differences between while loop and do while loop