NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

//program to find factorial number
#include<stdio.h>
int main()
{
int c=1, i ,n;
printf("Enter the numbern");
scanf("%d", &n);

for (i=1; i<=n ; i++)
{
c= c*i;
}
printf("Factorial of %d is: %d",n,c);
}



//program to check the armstrong number
#include<stdio.h>
int main()
{
int n,digit,sum=0;

printf("Enter the number");
scanf("%d",&n);
int m=n;
while(m!=0)
{
digit=m%10;
sum=sum+digit*digit*digit;
m=m/10;
}
if(n==sum)
{
printf("%d is the armstrong number",n);
}
else
printf("%d is not the armstrong number",n);
return 0;
}


//program to find the sum of two matrics
#include<stdio.h>
#define row 10
#define col 10
int main(){
int a[row][col],b[row][col],s[row][col],i, j, r, c;
printf("Enter the number of rows and columnsn");
scanf("%d %d", &r ,&c);

printf("Enter the elements of First matrixn");
for(i=0; i<r; i++)
{
for(j=0; j<c; j++)
scanf("%d", &a[i][j]);
}
printf("Enter the elements of second matrixn");
for(i=0; i<r; i++)
{
for(j=0; j<c; j++)
scanf("%d", &b[i][j]);
}
//calculate sum
for(i=0; i<r; i++)
{
for(j=0; j<c; j++)
s[i][j]=a[i][j]+b[i][j];
}
//display result
printf("the resulting matrix isn");
for(i=0; i<r; i++)
{
for(j=0; j<c; j++)
printf("%dt",s[i][j]);
print("n");
}
return 0;
}



//to fnd the fibonacci number
#include<stdio.h>
int main()
{
int a=0, b=1,f,n,i;
printf("n Enter the number");
scanf("%d",&n);
for (i=0;i<=n;i++)
{
f=a+b;
a=b;
b=f;
}
printf("The %dth fibonacci number is %d",n,f);
}



//to demostrate different components of function
#include<stdio.h>
void main()
{
int a,b,s;
printf("n Enter the numbers:");
scanf("%d%d",&a, &b);
s=sum(a,b);
printf("The required sum is %d",s);
}
int sum(int x,int y)
{
return x+y;
}



//factorial by recursive function
#include<stdio.h>
#include<conio.h>
int factorial (int);
void main()
{
int n,res;
printf("Enter the number: ");
scanf("%d",&n);
res=factorial(n);
printf("nThe factorial of %d is %d",n,res);
getch();
}
int factorial(int n)
{
if(n==0||n==1)
{
return(1);
}
else
{
return(n*factorial(n-1));
}
}

//program to check prime number
#include<stdio.h>
void main()
{
int n, i;
printf("n Enter the number n");
scanf("%d",&n);
for(i=2; i<=n/2; i++)
{
if(n%i==0)
{
printf("n %d is composite",n);
exit(0);
}
}
{
printf("%d is prime",n);
}
exit(0);
}

*
* *
* * *
* * * *
* * * * *

#include<stdio.h>
#include<conio.h>
int main()
{
int i,j;
for(i=1; i<=5; i++)
{
for(j=1; j<=i; j++)
{
printf("t*");
}
printf("n");
}
return 0;

for(i=1; i<=7; i++)
{
for(j=1; j<=i; j++)
{
printf("t*");
}
printf("n");
}
return 0;
}


//palindrome
#include<stdio.h>
int main()
{
int num,m, rev=0,digit;
printf("n Enter the numbern");
scanf("%d", &num);
m=num;
while(m!=0)
{
digit=m%10;
rev= rev*10+digit;
m=m/10;
}
if(num==rev)
printf("n %d is a palindrome", num);
else
printf("n %d is not a palindrome", num);
}




//sum of n natural number
#include<stdio.h>
void main()
{
int n,i,sum=0;
printf("Enter the value of n:");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
sum+=i;
}
printf("The sum is:%d",sum);
}


//program to find greatest number
#include <stdio.h>
void main()
{
int num1,num2,num3;
printf("Enter 3 Numbers:n");
scanf("%d%d%d",&num1,&num2,&num3);
if(num1>num2&&num1>num3)
printf("The Greatest Number is %d",num1);
else if(num2>num1&&num2>num3)
printf("The Greatest Number is %d",num2);
else
printf("The Greatest Number is %d",num3);
}

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.