Wednesday, December 1, 2010

Algorithm, Program & Output for Sum of digits of a number

Algorithm
  1. Start
  2. Read a number ‘n’
  3. Assign m with n, sum with 0
  4. If n ≠ 0 repeat steps (5) thru (7) else go to (8)
  5. k ß modulus(n,10)
  6. sum ß sum + k
  7. n ß quotient of n/10
  8. Print sum of digits of n is sum
  9. Stop
Program
#include <stdio.h>

main()
{
            int n,m,k,sum ;

            clrscr() ;
            printf("\tProgram to find Sum of Digits of a Number\n") ;
            printf("\n  Input\n\n") ;
            printf("Enter a Number : ") ;
            scanf("%d",&n) ;
            m = n ;
            sum = 0 ;
            while (n != 0)
              {
                  k = n%10 ;
                  sum += k ;
                  n = n/10 ;
              }
            printf("\n  Output\n\n") ;
            printf("Sum of Digits of %d is : %d",m,sum) ;
            getch() ;
}


Output
     Program to find Sum of Digits of a Number

  Input

Enter a Number : 1729

  Output

Sum of Digits of 1729 is : 19

       Program to find Sum of Digits of a Number

  Input

Enter a Number : -786

  Output

Sum of Digits of -786 is : -21

Algorithm, Program & Output for Sum of factors of a number

Algorithm
  1. Start
  2. Read a number ‘n’ > 0
  3. Assign sum with 0, i with 1
  4. If i<=n then repeat steps (5) and (6) else go to (7)
  5. If modulus(n,i) = 0
then sum ß sum + i and go to (6)
else go to (6)
  1. i ß i + 1
  2. Print sum of factors of n is sum
  3. Stop
 Program
#include <stdio.h>

main()
{
            int n,i,sum ;

            clrscr() ;
            printf("\tProgram to find Sum of factors of a Number\n") ;
            printf("\n  Input\n\n") ;
            printf("Enter a Number : ") ;
            scanf("%d",&n) ;
            sum = 0 ;
            for (i=1;i<=n;i++)
                if ((n%i) == 0)
                        sum += i ;
            printf("\n  Output\n\n") ;
            if (n <= 0)
                        printf("Enter greater than Zero") ;
            else
                        printf("Sum of factors of %d is : %d",n,sum) ;
            getch() ;
}


Output

Program to find Sum of factors of a Number

  Input

Enter a Number : 36

  Output

Sum of factors of 36 is : 91

Program to find Sum of factors of a Number

  Input

Enter a Number : 0

  Output

Enter greater than Zero

Wednesday, September 22, 2010

Algorithm for finding Result & Class in MS-Excel

  1. Start
  2. Click on Start Button à All Programs à MS Office à MS-Excel
  3. Enter the heading for the program at A1 to I2 cells
  4. Enter the given data from A4 to E13 cells, which is S.No., Name of the Student, Mathematics, Physics/Statistics and Computer Science with corresponding data
  5. Enter F4 to I4 cells : Total, Average, Result and Class headings
  6. Calculate Total for F5 cell as =Sum(C5 : E5), Average for G5 cell as =Average(C5 : E5), Result for H5 cell as =(IF(OR(C5<53,D5<35,E5<35),"Fail","Pass")) and the Class for I5 cell as
=IF(H5="Pass",IF(G5>=75,"Distinction",IF(AND(G5>=60,G5<75),"First",IF(AND(G5>=50,G5<60),"Second","Third"))),"Fail")
  1. Copy F5, G5, H5 and I5 cells formulae to Fth, Gth, Hth, Ith columns for remaining rows i.e., F6 to F13, G6 to G13, … after placing the mouse pointer at left, bottom of the cell and the mouse pointer changes to small + sign, and drag to those cells, then the other rows are filled with appropriate results
  2. Finally find out the Average marks of each subject by entering at some empty cells and by using the formula average(C5 : C13) for the subject at column C, like wise for other subjects also
  3. Save the worksheet with proper name and Close the Excel worksheet
  4. Stop



Algorithm for creating Charts in MS-Excel

  1. Start
  2. Click on Start Button à All Programs à MS Office à MS-Excel
  3. Enter the heading for the program at A1 to D1 cells
  4. Enter the given data from A3 to E8 cells, which is Year, Product-1, Product-2, Product-3 and Product-4 and corresponding data
  5. Click on Insert menu Chart option, opens Chart wizard window which is of 4 steps
  6. In Step 1 of 4, Select Chart type as Column and proper chart sub-type and click next button to proceed
  7. In Step 2 of 4, Select Data range is A3 to E8 cells and select Series in as rows and give proper names for each series and Category X-axis labels as A3 row which is all headings and click next button
  8. In Step 3 of 4, Type Chart title, X and Y axis titles, Axes, Gridlines, Legend, Data labels & Data tables as per your needs and click next button
  9. In Step4 of 4, Place the prepared Chart which is ready to place it as an object in Sheet1 or in a new excel worksheet and Finish
  10. Repeat Steps (5) thru (9) for 3D-Column and Bar Charts
  11. Save the worksheet with proper name and Close the Excel worksheet
  12. Stop





Algorithm for Number Conversions in MS-Excel

  1. Start
  2. Click on Start Button à All Programs à MS Office à MS-Excel
  3. A new blank worksheet is opened which contains A, B, C …. Rows and 1,2,3, … columns and the intersection of the rows and columns forms cells having the reference A1, A2, A3, … , B!, B2, B3, … etc.
  4. Enter the heading for the Program converting Decimal to Binary, Octal and Hexadecimal at 1st row
  5. Enter the given data in Ath column in the rows 3, 4, 5 …, and with appropriate headings in the columns B3, C3, D3 type the functions dec2bin(A4), dec2oct(A4), dec2hex(A4) functions respectively
  6. Copy B4, C4, D4 to remaining rows by placing the mouse pointer at the left, bottom corner of each cell and the mouse pointer changes to small + sign and drag it to other cells, then the other rows are filled with appropriate results
  7. Repeat step (5) and (6) for converting from Binary to others, Octal to others and Hexadecimal to others with appropriate functions by specifying proper cell references in the functions
  8. Save the worksheet with proper name and Close the Excel worksheet
  9. Stop


Algorithm for relating tables and generating Reports in MS-Access

  1. Start
  2. Click on Start Button à All Programs à MS Office à MS-Access
  3. A new blank database is opened. Use the Database wizard, where Tables, Queries, Forms, Reports, Pages etc., will appear on the left side in the wizard
  4. Click on Tables and create a table in Design view or by using wizard or by using entering data option to create the table structure with the given fields as columns with appropriate field names, data types to each field and click on Edit à Primary key option from menu bar to one appropriate column for two tables.
  5. Save it by entering table names to both the tables
  6. Enter the data properly to Employee Code, Employee Name and Basic Pay appropriately for table1
  7. Enter the data properly to Employee Code, Basic Pay appropriately for table2
  8. Click on Tools à Relationships option to relate the table1 and table2 by dragging Employee Code, which is the Primary key here
  9. Click on Queries and create a Query in Design view or by using wizard to create a query with Employee Code, Employee Name, Basic Pay by selecting the appropriate fields from each table
  10. Now add D.A. as an expression using function as : IIf ( [BasicPay]>=20000, [BasicPay]*40/100, IIf ( [BasicPay]>=10000 And [BasicPay] < 20000, [BasicPay]*30/100, [BasicPay]*20/100 ) ), H.R.A. as : [BasicPay]*25/100, and Gross Salary as : ([BasicPay]+[DA]+[HRA]) by entering the above formulae
  11. Save it by entering a query name and double click to see the rows of the query
  12. Report1 is created by using wizard view by following step by step process by including the required columns Employee Code, Employee Name, Basic Pay, D.A., H.R.A., and Gross Salary created while Query creation and finally save the report with an appropriate name
  13. Report2 is created by using wizard view by following step by step process by including the required columns Employee Code, Employee Name, Age, Gender and Gross Salary created and finally save the report with an appropriate name
  14. Double click the Reports to see the results of the reports in the desired format
  15. Close the database
  16. Stop








Algorithm for relating two tables in MS-Access

  1. Start
  2. Click on Start Button à All Programs à MS Office à MS-Access
  3. A new blank database is opened. Use the Database wizard, where Tables, Queries, Forms, Reports, Pages etc., will appear on the left side in the wizard
  4. Click on existing tables already created in the previous problem and now create two reports using Design view or by using Report wizard and  Save it by entering report names to both the reports
  5. Report1 is created by using wizard view by following step by step process by including the required columns Register Number, Name, marks of all subjects from the existing columns of tables and Total is already inserted as an Expression with the formula as : =(m1+m2+m3+m4+m5) while Query creation and finally save the report with an appropriate name
  6. Report2 is created by using wizard view by following step by step process by including the required columns Register Number from the existing column of any table, Total is already inserted as an expression with the formula as : (m1+m2+m3+m4+m5)  and Percentage as expression with the formula as : (total/5) while Query creation and finally save the report with an appropriate name
  7. Double click the Reports to see the results of the reports in the desired format
  8. Close the database
  9. Stop



Algorithm for creating a database and answering Queries in MS-Access

  1. Start
  2. Click on Start Button à All Programs à MS Office à MS-Access
  3. A new blank database is opened. Use the Database wizard, where Tables, Queries, Forms, Reports, Pages etc., will appear on the left side in the wizard
  4. Click on Tables and create a table in Design view or by using wizard or by using entering data option to create the table structure with the given fields as columns with appropriate field names, data types to each field and click on Edit à Primary key option from menu bar to one appropriate column for two tables.
  5. Save it by entering table names to both the tables
  6. Enter the data properly to Register Number, DOB, Gender, Class appropriately for table1
  7. Enter the data properly to Register Number, M1, M2, M3, M4, M5 marks appropriately for table2
  8. Click on Tools à Relationships option to relate the table1 and table2 by dragging Register Number, which is the Primary key here
  9. Click on Queries and create a Query in Design view or by using wizard to create a query with Register Number, Name, Gender and Total marks by selecting the appropriate fields from each table
  10. Save it by entering a query name and double click to see the rows of the query
  11. Again click on Queries and create a Query in Design view or by using wizard to create a query with Register Number, Name, Gender and Total marks by selecting the appropriate fields from each table and include sort for name in ascending order
  12. Save it by entering a query name and double click to see the rows of the query
  13. Close the database
  14. Stop




Algorithm for First Year Books in MS-PowerPoint

  1. Start
  2. Click on Start Button à All Programs à MS Office à MS-PowerPoint
  3. A new blank presentation is opened. Add the title as ‘Details of Text Books’ in the 1st slide
  4. In the add subtitle box type appropriately a subtitle relating to Courses & University
  5. By clicking on Insert menu, click on New Slide or Ctrl+M to get a new slide
  6. Type about Language text books in three different slides by inserting text book topcover available in the folder in My Computer using Insert à Picture à From file option, and about the details of author(s), publisher, edition and cost etc. of the text books are provided in the slide
  7. Repeat step (5) & (6) and type other group subjects text books’ details also in different slides with proper colouring and change of font size and provide animations by clicking Slide Show à Custom Animation à Add Effect and select the control to apply the animation available in the right pane for picture and text box
  8. By clicking on View à Master à Slide Master, change the font face, color, size and Background option by right clicking on the empty area on master slide to change as per interest to the Master slide which in turn affects all slides of the presentation
  9. Save the presentation with appropriate name and View it by clicking Slide show à View Show from the menu bar or F5 button to see the presentation
  10. Close the Presentation
  11. Stop

Algorithm for College Profile in MS-PowerPoint

  1. Start
  2. Click on Start Button à All Programs à MS Office à MS-PowerPoint
  3. A new blank presentation is opened. Add the title as ‘College Profile’ in the 1st slide
  4. In the add subtitle box type appropriately a subtitle
  5. By clicking on Insert menu, click on New Slide or Ctrl+M to get a new slide
  6. Type about college establishment, offering courses, groups and area of land, classrooms and strength available in one slide
  7. Repeat step (5) and type important points about categories of students available, infrastructure and other facilities provided in different slides with proper colouring
  8. By clicking on View à Master à Slide Master, change the font face, color, size and Background option by right clicking on the empty area on master slide to change as per interest to the Master slide which in turn affects all slides of the presentation
  9. Save the presentation with appropriate name and View it by clicking Slide show à View Show from the menu bar or F5 button to see the presentation
  10. Close the Presentation
  11. Stop

Algorithm for SWHF in MS-PowerPoint

  1. Start
  2. Click on Start Button à All Programs à MS Office à MS-PowerPoint
  3. A new blank presentation is opened. Add the title as ‘About me’ in the 1st slide
  4. In the add subtitle box type appropriately a subtitle
  5. By clicking on Insert menu, click on New Slide or Ctrl+M to get a new slide
  6. Type ‘About me’ in the Click to add title box and Name, Age, Date of Birth, Father’s Name, Mother’s Name and Class studying etc. details in the Click to add text box
  7. Repeat step (5) and type Strengths as title and two points on it
  8. Repeat step(5) and type Weaknesses as title and two points on it
  9. Repeat step(5) and type hobbies as title and two points on it
  10. Repeat step(5) and type factors that waste time as title and two points on it
  11. By clicking on View à Master à Slide Master, change the font face, color, size and Background option by right clicking on the empty area on master slide to change as per interest to the Master slide which in turn affects all slides of the presentation
  12. Save the presentation with appropriate name and View it by clicking Slide show à View Show from the menu bar or F5 button to see the presentation
  13. Close the Presentation
  14. Stop

Algorithm for Mail Merge concept in MS-Word

  1. Start
  2. Click on Start Button à All Programs à MS Office à MS-Word
  3. A new Blank document is opened, type the Interview call letter matter
  4. Click on Tools à Letters and Mailings à Mail Merge option which opens a 6 step process of Mail Merge to proceed further
  5. In Step 1 of 6, select the type of document as Letters type
  6. In Step 2 of 6, select the starting document is current document
  7. In Step 3 of 6, select the recipients from an existing list or type a new list
  8. In type a new list step, create a table with the required fields along with data for them and save the file as a database in a folder and it is ready for use
  9. Click on Tools à Letters and Mailings à Show Mail Merge Tool Bar and Insert the required fields at required places on the document to merge
  10. In Step 4 of 6, Write the letter or already written means just go to next step
  11. In Step 5 of 6, Preview your letters which will be merged and continue to see the letters for all recipients which are ready
  12. Save the document which is Main document by giving name and close it
  13. Stop