Free Tutorials, Linux Command, Source Code Architecture,  Software Engineering, Intelligent Systems, RDBMS, Computer Accounting,  Operations Research, Discrete Mathematics, Network, SAD Lay Networks Lay Networks
Computer Science Networking Operating Systems Linux and Unix Source Code Script & Languages Protocols Glossary
Web laynetworks.com
Google
 


Question 1. a : To Count number of character, words, & blank in a givent text

Clear

echo " Enter the String"

read str

echo $str > str.txt

len = 'echo $str | wc -c'

len = 'expr $len -1'

c= 0 , w = 0 , s = 0 , i = 1

echo " Length of string = $len"

w = 'echo $str | wc - w'

c = 'echo $str | wc -c'

while [ i -le $ len ]

do

st = 'cut - c$I str.txt'

if ["str" = " "] then

s = 'expr $s + 1'

fi

i = 'expr $i + 1

done

echo "Character = $c"

echo "Words = $w"

echo "Spaces = $s"

Question: 1.b : Write an algorithm/project to generate first prime numbers.

clear
no=1
r=0
while[$no -le 100]
do
t=0
i=1
while[$i -le $no]
do
rs='expr $no %$i'
if[$r -eq 0]
then
t='expr $i+1'
fi
i='expr $i+1'
done
if[$t -eq 2]
then
echo $no
fi
no='expr $no +1'
done

Algorithms

Step 1: START

Step 2: INPUT a positive number N to generate the

first N primenumbers.

Step 3: If N=1, then Print the number 2 and STOP.

Step 4: If N>1, then Print the first two prime numbers

2 and 3.

Step 5: Assign the value 2 to variable noprime and

value 4 tovariable num.

Step 6: If noprime=N, then goto Step-12.

Step 7: Assign value 2 to variable I.

Step 8: Divide the variable num by 2 and store in the

variable NUM1.

Step 9: Calculate the remainder of num divided by I

and store in variable number.

Step 10:If number=0, then increment num by 1 and goto

Step-7.

Step 11:If I=NUM1, then increment num by 1, noprime by

1,Print the value of num and goto Step-6.

Step 12:Increment the value of I by 1 and goto Step-8.

Step 13: STOP.

Question:1.C : Write a shell program to accept more than one month

#!/bin/sh
argstr=$@
argc=$#
year = `echo $argstr | awk '{print \$'$argc'`
cnt = 1
while { $cnt -lt $argc }
do
tmp = `echo $argstr | awk '{print \$'cnt '}'`
cal @tmp $year
cnt ='expr $cnt + 1'
done

Top

Back
Next
FDDI Frequently Asked Questions (FAQ), The function and frame format of FDDI,Aloha,Comparative analysis between two types of ATM Switches,Knockout Switch,Barcher-Banyan Switch,Various popular standards for compressing multimedia data,Distributed Multimedia Survey: Standards, ASCII to hex value chart,Comparative analysis - TCP - UDP, Addressing Formats and QoS parameters, Bellman Ford's Algorithm Lay networks, free, java, java script, asp, vb, linux, ignou, tutorial, Unix commands, System Analysis, System Design, Ipv6, quiz, download, free, Computer Architecture, Object Oriented System, Relational Database Management Systems, Object Oriented System, Operating Systems, Software Engineering, Communications and Networks, Discrete Mathematics, Intelligent Systems, Operations Research, Accounting and Finance on Computersmca, networking, protocols, glossary, assignment, project, tma, programming source code, programming, source code, unix, free
 
Book Mark/Share this site at BlinkBits BlinkList Blogmarks co.mments Delicious Digg Fark Furl it! Google Ma.gnolia Netvouz NewsVine RawSugar Reddit Shadows Simpy Stumble Technorati YahooMyWeb

Copyright © 2000- 2007 Lay Networks All rights reserved. 
This website is best viewed in Firefox 1.0.1 above.

Web Hosting sponsored by Customized Software Company India
Web Site Designed by Web Designing, Flash Animation, Multimedia Presentations, Broacher/catalogue designing, Web Promotion 
Refer to your freind About Us Legal IGNOU Contact Us Feedback Donate to laynetworks.com Download Management Tutorials Tutorials History Search here