Monday, 13 February 2017

11C-18.-Prog Write a program to compute Cosine series i.e.

18.   Write a program to compute Cosine series i.e.
Cos(x)= 1 – x2/2! + x4/4! – x6/6! + …xn/n!
Algorithm:
Input
1. x   //x=2
2. n  //n=3
Output
1. cx    // cosine series
Method:
1. start
2. Read x
3. Read n
4. //logic
cx=1;
j=2;
for(i=2;i<=n;i++)
begin
     fact=1;
     for(k=j;k>=1;k--)
   begin
      fact=fact*k
   end
    if(i%2==0)
    {
      cx=cx-pow(x,j)/fact;
    }
    else
    {
       cx=cx+pow(x,j)/fact;
     }
   j=j+2;
end
loop end
5.print cx
6.stop

11C-19 Write a program to print Fibonacci series i.e.0 1 1 2 3 5 8………

11C-19 Write a program to print Fibonacci series i.e.0 1 1 2 3 5 8………

Algorithm:
Input:
1)n
Output:
1)fibonaci numbers 0 1 1 2 3 5 ...
Method:
1. Start
2. Read n
3. Print n
4. //logic
5. f1=0;
6. f2=1;
7. print f1 and f2
8. for(i=3;i<=n;i++)
   begin
     f3=f1+f2
     print f3
     f1=f2
     f2=f3
   end
9.stop

Wednesday, 1 February 2017

11C-Prg-20. Write a Algorithim and Program to find a given number is Angstrom or not.




  Write a Algorithim and Program to find a given number is Angstrom or not.
  Algorithim:
        Input:
    1.      Num 
Output 
1.      The Num is Armstrong or not
Method:
1.     Start
2.    .  Read Num
3.      Print Num
4.       //logic
T=Num;
Sum=0;
While(Num != 0)
{
    Rem = Num % 10;
    Cub = pow(Rem,3);
    Sum=Sum + Cub;
    Num = Num /10;
}
if (Sum = = T)
    Print “ The given no is Armstrong”;
else
    Print” The given no is not Armstrong”;
5.    .  Stop

Monday, 23 January 2017

11C-UT-3 Blue Print-2017

I- Two Dimensional Array  - 10 marks
  * Manipulation Array elements with application problems

II. User defined function.-15
     * 4 styles of functions
     * call by value and reference
     * function writing for the description
     * Output finding
      * concept
III structure-15
      * Programme writing
       * output finding
       *  concepts      

 

Wednesday, 4 January 2017

11C-prg-17 Write a algorith and program whether a given character is an alphabet, digit or any other character.

Write a algorith and program whether a given character is an alphabet, digit or any other
character.

Algorithm:

Input:
1. ch  //character

Output:
1. al/dig/spec

Method:
1. start
2. Read ch
3. Print ch
4. //logic

  if(isalpha(ch))
   Print " The character is an alphabet "
  else
  if(isdigit(ch))
   print " The character is an digit"
  else
   Print " It is a special character"
5.Stop
 

Wednesday, 7 December 2016

11C Prog16. Write a algorithm and C++ program to calculate commission for the salesman. The commission is calculated according to the following rates:

16.   Write a algorithm and C++ program to calculate commission for the salesman.
The commission is calculated according to the following rates:
SALESMAN COMMISSION RATE COMMISSION
30001 onwards 15%
22001-30000 10%
12001-22000 7%
5001-12000 3%
0-5000 0 %
The program accepts the sales made by the salesman and display the
calculated commission.

Algorithm

Input
1. sm //sales amount
output
1. com  //commission
Method:
1.start
2.Read sm
3.Print sm
4. //logic for commission calculation

  if(sm > 30000)
    cm=(15*sm)/100;
  else
  if ( (sm >= 22001) && (sm <=30000) )
    cm=(10*sm)/100;
  else
  if ( (sm >= 12001) && (sm <=22000) )
    cm=(7*sm)/100;
  else
  if ( (sm >= 5001) && (sm <=12000) )
    cm=(3*sm)/100;
  else
    cm=0;
 
 5. Print cm
 6. stop

Monday, 7 November 2016

11C-Prog-15. Write a Algorithm and Program to calculate factorial of an integer.

15.   Write a Algorithm and Program to calculate factorial of an integer.

Algorithm:
Input
1) n
Output:
1)fact

Method
1.Start
2.Read n
3.print n
4. //logic

  fact=1;
 for(i=1;i<=n;i++)
 begin
   fact=fact*i;
 end;
5.print "factorial=",fact;
6.stop