Posts
Showing posts from March, 2017
a function f(x).....in fortran
- Get link
- X
- Other Apps
!Write a function for the function f(x) defiend as followos !f(x)=2*x*x+3*x+4 for x<2 !f(x)=0 for x=2 !f(x)=2*x*x+3*x-4 for x>2 program function_f_x implicit none interface function f(x) real ::f real,intent(in)::x end function f end interface real::x print*,"Please entre value of x" read*,x if(x==2)then print*,"f(x)=0" elseif(x>2)then print*,"f(x)=2*x*x+3*x-4" ...
A function in fortran.
- Get link
- X
- Other Apps
!Illustrate use of function sub program !function sub program is given below program func_use implicit none interface function S(x) real::S real,intent(in)::x end function end interface real::x,g print*,"Please entre the value of x" read*,x print*,"x=",x g=S(x+2)+S(x**2) print*,"g=",g end program func_use function S(x) implicit none real::S real,intent(in)::x S=x**2+x+4 end function
- Get link
- X
- Other Apps
!Tabulate the function !f(x,y)=(x**2+y**2+2*x*y)/(x**2+y**2+8*x*y) !for the following set of values of (x,y) !(x,y)=(0,-10);(2,-8);(4,-6);(6,-4);(8,-2);(10,0) and (12,2). program two_diomonsional_function_tabulation implicit none real ::f_x,x,y integer ::i print*," x"," "," y"," "," f(x)" do i=0,12,2 x=i y=i-10 f_x=(x**2+y**2+2*x*y)/(x**2+y**2+8*x*y) print*,x,y,f_x enddo end program two_diomonsional_function_tabulation
- Get link
- X
- Other Apps
!write a program to evaluate the following sum: !S=summetion(-1)**n*(x)**(n/2)/(n*(n+1)) for n=1 to 10 program sum_of_a_series implicit none real::x,s_x integer::n print*,"Type value of x" read*,x print*,"x=",x s_x=-.5*sqrt(x) do n=2,10,1 s_x=s_x+s_x*(-1)**n*x**(.5*n+.5)/(n*(n+2)) enddo print*,"S=",s_x end program sum_of_a_series
- Get link
- X
- Other Apps
!given an integer, write aprogram to reverse and print it. program reverse_integer implicit none integer::n,digit,reverse_number reverse_number=0 print*,"type the number" read*,n print*," number=",n do if(n==0)then exit else digit=mod(n,10) reverse_number=(digit+reverse_number)*10 n=n/10 endif enddo reverse_number=reverse_number/10 print*,"reverse_number=",reverse_number end program reverse_integer
- Get link
- X
- Other Apps
program point_position implicit none real ::x,y print*,"Please type point x,y"!this program find the position of a point among four quadrant read*,x,y print*,"x=",x,"y=",y if (x>0)then if(y>0) then print*,"the point lies on First quadrant" else print*,"The point lies on Fourth quadrant" endif else if(y>0)then print*,"The point lies on Second quadrant" else print*,"The point lies on Fourth quadrant" endif endif end program point_position
- Get link
- X
- Other Apps
!Given a set of integers write a program to find those which are palindromes. !For example ,the number 123321 is a palindrome as it reads the same !from left to right and from rigfht to left program palindrome implicit none integer::x,digit,rev_x,y rev_x=0 print*,"Type the number" read*,y print*,"number is",y x=y do if(x==0)then exit else digit=mod(x,10) x=x*0.1 rev_x=(rev_x+digit)*10 endif enddo rev_x=rev_x/10 print*,"The reverse of the typed number is=",rev_x if(y==rev_x)then PRINT*,"The number is a palindrome number" else print*,"The number is not a palindrome number" endif print*,y end program palindrome
- Get link
- X
- Other Apps
! Given an octal number (a number in base 8) of arbitrary length write a program to !find its decimal equivalent of the octal number 2673 is !2*8**3+6*8**2+7*8**1+3*8**0 program octal_decimal implicit none integer::octal_num,decimal_num,octal_digit,decimal_digit,i decimal_num=0 i=-1 print*,"Input the octal number" read*,octal_num print*,"The Octal number is=",octal_num do if(octal_num==0)then exit else octal_digit=mod(octal_num,10) octal_num=octal_num/10 i=i+1 decimal_num=octal_digit*(8**i)+decimal_num endif enddo print*,"Decimal equivalent number is=",decimal_num print*,"last power",i end program octal_decimal
- Get link
- X
- Other Apps
!Write a program which will evaluate the function f for the set of values of x(0.5,1,1.5,2,2.5,3) !and tabulate the results. !f=1+x**2/2!,+x**4/4!-50*(sinx)**2+(4-x**2)**(1/2) program func_tabulation implicit none real::f_x,x integer::i!how many do reapet perfrom x=0!initial value its value changing with 0.5 inside of do loop print*,"x"," ","f(x)" do i=1,6,1!we get six result x=x+.5 f_x=1+(x**2)/(2*1)+(x**4)/(4*3*2*1)-50*(sin(x))**2+(4-(x**2))**.5 print*,x,f_x enddo end program func_tabulation
- Get link
- X
- Other Apps
!Given values for a,b,c and d and a set of values for the variable x evaluate the function defiend by !f(x)=a*x**2+b*x+c if=x<d !f(x)=0 ifx=d !f(x)=-a*x**2+b*x-c if x>d program function_x implicit none real::f_x,x,a,b,c,d print*,"Input a,b,c,d" read*,a,b,c,d,x print*,"a=",a,"b=",b,"c=",c,"d=",d,"x=",x if(x<d)then f_x=a*(x**2)+b*x+c else if (x==d)then f_x=0 else if(f_x>d)then f_x=-a*(x**2)+b*x-c endif endif print*,"f(x)=",f_x end program function_x
Fortran Examples...........
- Get link
- X
- Other Apps
1 !write a program to read the radius of acircle and compute its area and circumference program circular_case implicit none real :: radius,area,circumference read*,radius print*,"radius=",radius,"unit" circumference=2*22*radius/7 print*,"circumference=",circumference,"unit" area= 22*(radius**2)/7 print*,"area=",area,"square unit" end program circular_case 2!Write a program to convert Celsius temperature to fahrenheit Program fahrenheit_celsius!Write aprogram to convert cuselsi temperature to fahrenheit Program fahrenheit_celsius implicit none real :: fahrenheit,celsius read*,celsius fahrenheit=(9*celsius)/5+32 print*,"celsius=",celsius," ","fahrenheit=",fahrenheit end program fahrenheit_celsius implicit none real :: fahrenheit,celsius read*,celsius fahrenheit=(9*celsius)/5+32 print*,"celsius=",celsius," ","fahrenheit=",fahrenheit end program fahrenheit_celsiu...
- Get link
- X
- Other Apps
some Important ubuntu command! 0.pwd(print working directory) 1.sudo (superuser do---to handel a root account,you can see I gonna using a sudo in front of many comand) 2.whoami(Identifying computer) 3.sudo su(switch to other user i.e we can using command without using sudo) 4.sudo apt-get install application_name/package_name(For installing a application without using softwar centre or installing a package) 5.cd(change directory or going to a specified directory location,cd .. for using going to back) 6.ls(list of file and folder in the current directory) 7.sl(steam engine,For making a funny animation) 8.mkdir directory-name(For making a direc...