From 98f7ac49ca3ae16d20823de50a9adc19c65ba65f Mon Sep 17 00:00:00 2001 From: Chaitali3005 Date: Wed, 7 Oct 2020 23:21:03 +0530 Subject: [PATCH] Added Basic C program --- ALPHABET.C | 25 +++++++++++++++++++++++++ COMPOUND.C | 25 +++++++++++++++++++++++++ NSTRONG.C | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 ALPHABET.C create mode 100644 COMPOUND.C create mode 100644 NSTRONG.C diff --git a/ALPHABET.C b/ALPHABET.C new file mode 100644 index 0000000..f8324a3 --- /dev/null +++ b/ALPHABET.C @@ -0,0 +1,25 @@ +#include +#include + +void main() +{ + char c; + + clrscr(); + + printf("Enter the Character:"); + scanf("%c",&c); + + if((c>='a'&& c<='z') || (c>='A'&& c<='Z')) + { + printf("It is an Alphabet."); + } + + else + { + printf("It is not an Alphabet."); + } + + getch(); + + } \ No newline at end of file diff --git a/COMPOUND.C b/COMPOUND.C new file mode 100644 index 0000000..886a9cc --- /dev/null +++ b/COMPOUND.C @@ -0,0 +1,25 @@ +#include +#include +#include +void main() +{ + float p,r,t,i,n; + + clrscr(); + + printf("Enter the Principal Amount:"); + scanf("%f",&p); + printf("Enter the Rate of Interest:"); + scanf("%f",&r); + printf("Enter the Time Period:"); + scanf("%f",&t); + + + i=p*(pow(1+r/100,t)); + + printf("The Compound Interest is %.2f.",i); + + getch(); + + } + diff --git a/NSTRONG.C b/NSTRONG.C new file mode 100644 index 0000000..32a52f2 --- /dev/null +++ b/NSTRONG.C @@ -0,0 +1,43 @@ +#include +#include +void main() +{ + int i,n,fact=1,temp,rem,sum=0; + + clrscr(); + + printf("Enter limit n:"); + scanf("%d",&n); + printf("The Strong Numbers Between 1 to %d are:\n",n); + + i=1; + + while(i<=n) + { + temp=i; + sum=0; + while(temp>0) + { + rem=temp%10; + fact=1; + + while(rem>0) + { + fact=fact*rem; + rem--; + } + sum=sum+fact; + temp=temp/10; + } + if(sum==i) + { + printf("%d\t",i); + } + + + + i++; + } + + getch(); + }