Posts

Showing posts from April, 2021

Factorial of a number in c programming

Image
  Factorial of a number in c programming:- #include<studio.h> main() {   int number,factorial=1,i;   printf("Enter a number for knowing it's factorial\n");   scanf("%d",&number);   for(i=1;i&lt;=number;i++)   {    factorial=factorial*i;   }   printf("%d!=%d\n",number,factorial); } Output:- Enter a number for knowing it's factorial 5 5!=120 Explanation:- Initializes : number -for storing given number factorial -for storing factorial of a number. i  for using in loop Prompting user for input through scanf statement. The main logic goes here:(factorial=factorial*i) i =1 and i<=number(say 5) which is true then factorial=1*1=1 then i increments by 1 Now  i =2 and as i<=5 which is true then  factorial = 1*2=2 .Now i increases by 1 Now  i =3 and as i<=5 which is true then  factorial = 2*3=6 .Now i increases by 1 Now  i =4 and as i<=5 which is true then  factorial = 6*4=24 .Now i incre...

Print alphabet from A-Z in c programming

Image
  Print alphabet from A-Z in c programming:- main() {  int i;  for(i=65;i&lt;=90;i++)  {  printf("%c\n",i);  } } Output :- A B C D . . . . . . Z

Print 1to 100 in c programming

Image
  Print 1to 100 in c programming :- main() {    int i;    for(i=1;i&lt;=100;i++)    {       printf("%d\n",i);    } }          Output:- 1 2 3    4 . . . . 100 Subscribe my blog

Hacker

Image
 

Hacker

Image
 

Hello world C programming

Image
  #include<studio.h> main() { printf ( "Hello World\n" ); } Output Hello world

Introduction

Image
Hy myself Chandan Soni Welcome my blog