0% found this document useful (0 votes)
4 views

cs11 1

Class 11th computer science notes for vocational courses HSC Board

Uploaded by

krishnamarne67
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

cs11 1

Class 11th computer science notes for vocational courses HSC Board

Uploaded by

krishnamarne67
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

SBOA SCHOOL & JUNIOR COLLEGE,CHENNAI-101.

STD XI-2016-2017
COMPUTER SCIENCE ASSIGNMENT – 3

Find the output of the following


1) #include<iostream.h>
void main()
{ int k=30;
cout<<k++<<++k<<k+1<<k;}
2)void main()
{ int a=500;
int b= (a<500)?3:2;
cout<<a <<endl<<b;}
3)void main()
{ const char y=’a’;
for(char x=y;x<’c’,x<=’d’)
cout<<x++<<endl;}
4)void main()
{ char y=’a’;
for(char x=y;x<’c’,y<=’d’) cout<<x++<<endl<<y++<<endl;}
5)void main()
{ char y=’a’;
for(char x=y;x<’c’,y<=’b’)
cout<<x++<<endl<<y++<<endl;}
6)#include<iostream.h>
Void main()
{ int x,sum=0;
cin>>n;
for(x=1;x<10;x+=2)
if(x%2==0)
sum-=x;
cout<<”sum=\n”<<sum;}
SBOA SCHOOL & JUNIOR COLLEGE,CHENNAI-101.
STD XI-2016-2017
COMPUTER SCIENCE ASSIGNMENT – 4
1 )#include<iostream.h> // x value is 5
Void main()
{ int x; cin>>x;
for(int y=0;y<10;y++)
cout<<x+y;}
2) void main()
{ int x=10,y=20;
cout<<x--;cout<<”,”;cout<<--x;
cout<<”,”<<y--<< --y<<endl<<x+y;}
3)void main()
{ int i=0,x=0;
do
{ if(i%2==0)
cout<<x;x++;}++I; }while(i<10);cout<<’\n’<<x;}
4) void main()
{ float X,Y;
cin>>X>>Y;
switch(X>Y)
{ case 1.5: cout<<X+Y;
case 2.5: cout<<X*Y;
break;}}
5) convert following into switch case statement
void main()
{ int ch; cin>>ch;
if(ch==1)
{cout<<”Laptop”;}
else if(ch==2)
{cout<<”Desktop”;}
else if(ch==3)
{cout<<”Notebook”;}
else
{cout<<”Invalid Choice”;}
6) convert following into while loop
void main()
{ int i; for( i=1;i<=20;++i)
cout<<”\n”<<I;}
7) int ch=50;
cout<<ch++<<++ch<<endl<<ch--<<--ch<<--ch;
SBOA SCHOOL & JUNIOR COLLEGE,CHENNAI-101.
STD XI-2016-2017
COMPUTER SCIENCE ASSIGNMENT – 5

1) convert following into for loop


int x=0;
while(x<=100)
{ cout<<” I love \t”;
cout<<” CS\n”; x+=2;}
2) void main()
{ char a,b;
for( a=’a’;a>=’e’,a++)
{ for( b=’e’;b<=’a’;b--)
cout<<--b<<b<<’t’;
cout<<endl;}}
3)void main() // n=35, 60
{ int n,c; cin>>n;
if(n<=25 || n>=50)
{ c=n*10-20;
cout<<n+c++;}
else if (n>=25 && n<=50)
{ c=n*10+20;
cout<<n-(++c);}
4)Find the errors
void main()
{ int x[5],y,z[5];
for(i=0,i<5,i++)
{ x[i]=i ; z[i]= i+5; y= z; x=y;}}
4) void mani()
{cin<<i<<j;
while(i<j);
if (i=2)
cout<< i;
++i ;
else
cout<<j;
j++;
}
5)include<iostream.h>
void main()
{ int x,y; cin>>x; for(x=0,x<5;++x)
cout y else cout<<x<<y;}
6)#include(iostream.h)
void main()
{ int X,Y;
Cin>>x; for(Y=0;Y<10;Y++)
If X==Y
cout<<Y+X; else cout>>Y;}
7)main<>
{ int c;
Switch(c);
Case 1.5:{ cout<<”Be Indian\t”;}
Break;
Case ‘2’:{ cout<<”Buy Indian \t”}
break;
}//end main }//end switch

6) void main()
{ cin<<num; float area=l*b;}
7) #include<iostream.c>
void main()
{ int i; j,k;
cin>>i;>>j>>k; conio=i*k;}
8) if(z=!1);
x=1;
else if ((z<=5) x==2;elsex=’d’;
SBOA SCHOOL & JUNIOR COLLEGE,CHENNAI-101.

CLASS XI WEEK END ASSIGNMENT

COMPUTER SCIENCE
USE FOR LOOP

1.Write a c++ program to generate the output of following series


1. 1 2 3 ……..500
2. 2 4 6………500
3. 1001 999 997….1
4. 1+2+3+….upto n
5. 2+4+6+….. upto n
6. 12+22+32+….+n2
7. 13+33+53+….+n3
8. 1+ 1/x+1/x2+1/x3+…..+1/xn
9. 1-2/x+4/x3-6/x5……..n/xn-1
10. 1!+2!+3!+…….+n!
11. 1-x/1!+x2/2!-x3/3!+…………n terms
12. a c e ………z
13. 0.5 1.0 1.5 2.0 …. N terms
14. A E I………. Z
15. A B C …… J

2.Write a c++ to print the multiplication table.


3. Write a c++ to find the factorial of a given number.
4. Write a c++ to find the factors of the given number.
5. Write a c++ to find the greatest common divisor of given number.
6. Write a c++ to check whether given number is prime or not.
7. Write a c++ to find the LCM of given to two numbers.
8. Write a c++ to accept any 50 numbers and find the sum of even numbers and sum of
odd numbers.
9. Write a c++ to accept any 10 numbers and find the sum of positive numbers and sum
of negative numbers.

You might also like