Skip to main content


Showing posts with the label basic programming in c

What is an algorithm in computer science ?

 What is an algorithm in computer science ?- You may have heard the term  algorithm  recently, whether it was online or perhaps in some conversation about technology. It's a word that gets thrown around a lot, but what does it mean exactly? suppose your mom gave you a task to prepare a cup of tea for her. How do you prepare a cup of tea for her ? definitely, to prepare a cup of tea you are gonna follow the following steps 1- Boil water. 2- Warm up teapot 3-  Put the tea into a teapot and add hot water. 4- Cover teapot and steep tea 5- Strain tea solids and pour hot tea into tea cups. Basically preparing tea was a problem and you follow some step-by-step procedures to solve this problem.  similarly, in computer science,  An algorithm is simply a  set of steps used to complete a specific task . They're the building blocks for programming, and they allow things like computers, smartphones, and websites to function and make decisions. An algorithm is a specific procedure for solvin

find factorial of any number using recursion in c

factorial of any number using recursion in c c language mai recursion ka us krke kisi number ka factorial  #include<stdio.h>           //header file int fac(int);                     //function definition void main()                   //main function {int a,s;                           //main k under k variable scanf("%d",&a);           //input number by user s=fac(a);                       // value assigned in s printf("%d",s);            //s ki final value jo factorial k baad niklegi } int fac(int x)                  //fac() function ka declaration { if(x==0) return 1; x=x*fac(x-1); return x; }

c programming/ for loop in c

                                      c# programming for loop in c Loop in c language- c# programming C   language mai jab kise statement ko hum   baar baar reapeat krwana chate hai to uske liye loop ka use kiya   jata hai Loop ek type ka action statement hai C language mai 3 type k loop hote hai 1-    While loop 2-       Do while  loop 3-       For loop Chalo ab while loop ko   example se se smjhte hai:- Agar mai apne   naam ko screen pe 5 baar print krwana chahta hu to mujhe ya to 5 baar printf function ka use krna padega ya 5 baar apna naam likhna padega But agar mai baar baar likhne se bachana chahta hu toh loop ka use krte hai main() { Int x; clrscr(); scanf(“%d”,&x); while(5>x)        //yaha bracket k under condition likhi jati hai agar ye condition true ho to while loop     ka block     chalega agar false ho to nhi chalega yaha maine likha hai ki agar enter kiya gya no 5 se chota hai to while ka box chalao n