Top 10 Programming Language to learn in 2023

Are you a programming enthusiast looking to stay ahead of the curve in 2023? With the ever-evolving tech landscape, keeping up with the Best Programming Language to learn can be a daunting task. Fear not, as we have compiled a list of the top 10 Programming Languages that you should consider learning in 2023. Python: This versatile language continues to dominate in 2023, with its ease of use, readability, and a vast library of modules. JavaScript: As web development grows increasingly popular, JavaScript remains a crucial player, with its ability to create dynamic and interactive web pages. Java: This language has stood the test of time and remains a popular choice for enterprise software development. C++: A staple in the gaming and systems development industries, C++ offers exceptional performance and memory management. Swift: Apple's preferred language for iOS app development, Swift continues to grow in popularity with its simplicity and reliability. R: As data science and machin...

C Program for Shooting Method | C Programming

Introduction

The shooting method is a method for solving a Boundary Value Problem by reducing it to the solution of an Initial Value Problem. Roughly speaking, we 'shoot' out trajectories in different directions until we find a trajectory that has the desired boundary value.



C Code For Shooting Method


#include<stdio.h>
#include<conio.h>
#include<math.h>
#define f1(x,y,z) (z)
#define f2(x,y,z) 6*(x)
int main(){
 float xa,xb,ya,yb,x0,y0,z0,x,y,z,xp,h,sol,ny,nz,error,E,g[3],v[3],gs;
 int i;
 printf("\nShooting method");
 printf("\nEnter the boundary conditions\n");
 scanf("%f%f%f%f",&xa,&ya,&xb,&yb);
 printf("Enter x at which value is required\n");
 scanf("%f",&xp);
 printf("Enter the step size\n");
 scanf("%f",&h);
 printf("Enter the accuracy limit\n");
 scanf("%f",&E);
 
 for(i=1; i<=2;i++){
  x=xa;
  y=ya;
  g[i]=z=i*(yb-ya)/(xb-xa);
  printf("g=%f\n",g[i]);
  while(x<xb){
   ny=y+(f1(x,y,z))*h;
   nz=z+(f2(x,y,z))*h;
   x=x+h;
   y=ny;
   z=nz;
   if(x==xp)
    sol=y;
  }
  v[i]=y;
  error=fabs(y-yb)/y;
  if(error<E){
   printf("y(%f)=%f",xp,sol);
   break;
  }
 }
 
 while(1){
  x=xa; y=ya;
  gs=z=g[2]-(v[2]-yb)/(v[2]-v[1])*(g[2]-g[1]);
  while(x<xb){
   ny=y+(f1(x,y,z))*h;
   nz=z+(f2(x,y,z))*h;
   x=x+h;
   y=ny;
   z=nz;
   if(x==xp)
    sol=y;
   
  }
  error=fabs(y-yb)/y;
  v[1]=v[2]; v[2]=y;
  g[1]=g[2]; g[2]=gs;
  
  if(error<E){
   printf("y(%f)=%f",xp,sol);
   break;
  }
 }
 
 getch();
 return 0;
}

Comments

Popular posts from this blog

Array in C Programming | C Programming

C program to Find Cartesian Product of Two Sets | C programming

What is System? | SAD