Posts

Showing posts from August, 2021

Best program to calculate compound interest

      C ODE:- #include <stdio.h> int main() {     int p,t;     float i,r,a;     printf("Enter the principle amount.");     scanf("%d",&p);     printf("Enter the rate: ");     scanf("%f",&r);     printf("Enter the total time taken: ");     scanf("%d",&t);     for(int j=1;j<=t;j++)     {         i=p*r/100;         a=i+p;         p=a;         printf("Amount after %d years= %f\n",j,a);     }     printf("*******Total amount to paid= %f*******",a);     return 0; }

C Program to identify the number is prime or not.

 CODE:- #include<stdio.h> #include<conio.h> void main() { int num,i,rem; int flag=0; printf("Enter the number="); scanf("%d",&num); for(i=2;i<num;i++) {     rem=num%i;     if(rem==0)     {         flag=1;         break;     }     else     continue;      } if(flag==1) printf("%d is not prime number.",num); else printf("%d is prime number.",num); }

TO calculate reverse of number by using c programming

  CODE: - #include <stdio.h> int main() {     int total=0;     int d,rem;     printf("Enter the  number= ");     scanf("%d",&d);     do     {         rem=d%10;         d=d/10;         total=total*10+rem;     }     while(rem>0);     total=total/10;     printf("reverse of number = %d",total);     return 0; }

Program to calculate sum of digit of number

 CODE:- #include <stdio.h> int main() {     int total=0;     int rem, d;     printf("Enter the number= ");     scanf("%d",&d);     do     {         rem=d%10;         d=d/10;         total=total+rem;     }     while(rem>0);     printf("Sum of digit number = %d",total);     return 0; }

C program to cut paper parallel to short length.

CODE:- #include <stdio.h> int main() {     int l=1189;     int b=841;     printf("The dimension of A0 paper= %d mm x %d mm\n",l,b);     for(int i=1;i<=8;i++)     {         if(l>b)         {             l=l/2;             b=b;             printf("The dimension of A%d paper= %d mm x %d mm\n",i,l,b);         }         else         {             l=l;             b=b/2;             printf("The dimension of A%d paper= %d mm x %d mm\n",i,l,b);         }     }     return 0; }

Calculator to find Percentage of mark obtained by using C Program

 CODE:- #include <stdio.h> int main() {     float s,m,n,e,p;     float a,ap;     printf("Enter the mark obtained in Science= ");     scanf("%f",&s);     printf("Enter the mark obtained in Math= ");     scanf("%f",&m);     printf("Enter the mark obtained in nepali= ");     scanf("%f",&n);     printf("Enter the mark obtained in english= ");     scanf("%f",&e);     printf("Enter the mark obtained in Population= ");     scanf("%f",&p);     if(s,m,n,e,p<0 || s,m,n,e,p>100)     {         printf("invalid input plz correct the input mark...");     }     else     {         a=s+m+n+e+p;         ap=a*100/500;         printf("Total Aggreate mark obtained is:- %f\n",a);         printf("Total Percen...

C program to calculate range of number

 CODE:- #include <stdio.h> int main() {     int num,range;     int large=0,small=100000;     for(int i=1;i<=10;i++)     {         printf("please enter the %d number: ",i);         scanf("%d",&num);         if(num>large)         {             large=num;         }         if(num<small)         {             small=num;         }     }     range=large-small;          printf("Range of number You entered= %d",range);     return 0; }

Simple C program to convert decimal to octal number.

 CODE:- #include <stdio.h> int main() {     int num,oct,rem;     int total=0;     int octal=0;     printf("please enter the number that you want to convert into octal number:- ");     scanf("%d",&num);     int deci=num;     do     {        rem=num%8;        num=num/8;        total=total*10+rem;             }     while(rem>0);     total=total/10;     printf("Total=%d\n",total);     do     {         rem=total%10;         total=total/10;         octal=octal*10+rem;     }     while(rem>0);     octal=octal/10;     printf("octal of %d is %d",deci,octal);          return 0; }

Simple last Selector Looser game by using "c".

Image
 Algorithm:- 1)Take i=21; 2) player 1 Enter the value among 1,2,3,4 as c1. 3) i=i-c1 4) Print remaining number after subtraction. 5) Player 2 enter the number among 1,2,3,4 as c2 but less than remaining after subtraction. 6) Repeated above process till i==0; 7) if process end after Player 1 selection then player 1 loose , else player2 loose. CODE:- #include <stdio.h> int main() {     int i=21;     int s1,s2;//r1,r2;     while(i>0)     {         printf("Player 1 Enter the number 1,2,3,4=");         scanf("%d",&s1);        // printf("Player 2 Enter the number 1,2,3,4=\n");        // scanf("%d",&s2);         if(s1>=1 && s1<=4)         {         i=i-s1;         if(i==0)         {             printf("\n  ...

program to identify Lower case, Upper case, Digits and Special character

 CODE: - include <stdio.h> int main() {     char c;     printf("Enter a character: ");     scanf("%c", &c);    // (sal>=25000 && sal<=40000)?(printf("manager")):(sal>=15000 && sal<=25000)?(printf("Accountant")):(printf("clerk"));    printf("Ascii value of above %c= %d\n",c,c);    if(c<=90 && c>=65)    {        printf("*******************You Entered is Capital letter.*******************");    }    else if(c<=122 && c>=97)    {        printf("*******************You Entered small letter.*******************");    }    else if(c<=57 && c>=48)    {        printf("*******************You Entered Digit.*******************");    }    else if(c<=47 && c>=0 || c<=64 && c>=58 ||c...

Algorithm and C code to find day of Year.

 Following is algorithm to find day of year:- 1) Input Year, month, day. 2) Take last 2 digit of Year as last_digit 3) Divide last 2 digit by 4 as divlast 4) Enter code for year as yearcode. 5) Enter code for month as monthcode. 6) Sum day,last_digit,divlast,yearcode,monthcode as add 7) If year is leap year and month=1 or 2 then add%7 and minus 1 and save as result. 8) else result=add%7 9)if result=0-->sunday;=1--.monday;=2-->tuesday;=3-->wednesday;=4-->thrusday;=5-->friday;=6-->saturday. CODE:- #include <stdio.h> int main() {     int y,m,d,yearcode,last_digit,divlast,monthcode,add,result;     printf("Enter the year= ");     scanf("%d",&y);     printf("Enter the month= ");     scanf("%d",&m);     printf("Enter the day= ");     scanf("%d",&d);     if(y<=3000 && m<=12 && d<=32)     {         last_digit=y%100;  ...

Professional java code to calculate Provident fund

Image
 CODE:- import java.io.*; import java.util.Scanner; public class Main { public static void main(String[] args) {     Scanner sc=new Scanner(System.in);     System.out.println("Enter the rate:- ");     int r=sc.nextInt();     System.out.println("Enter the monthly installment");     int in=sc.nextInt();     int p=in*12;     for(int i=1; i<=35; i++)     {         int interest=p*r/100;         p=p+interest;         System.out.println("The amout after "+i+" = "+ p);         p=p+in*12;     }     System.out.println("  *****************    ***************   ****************  ************   "); System.out.println("The total amount after 35 years= "+p); } } OUTPUT:-

Provident fund and Simple java program to calculate it.

Image
  A provident fund is an investment fund that is jointly established by the employer and employee to serve as a long term savings to support an employee upon retirement. CODE:- In java programming language. public class Main { public static void main(String[] args) {     int r=12;                           //Rate of interest     int p=24000;                     //The amount paid yearly     for(int i=1; i<=35; i++)   // created loop to calculate compounding for 35 year     {         int interest=p*r/100;    //interest         p=p+interest;             //Total amount         System.out.println("The amout after "+i+" = "+ p);         p=p+24000;      ...

Benefits of Ncell

 Do you know Top 5 benefits of Ncell App? 1. FREE 1GB data on the first usage and 10 FREE SMS Daily 2. DOUBLE OFFER on Voice & Data packs 3. NO DATA CHARGE while using app 4. MULTIPLE NUMBER management 5. Remaining data/voice pack info with expiry date and time Download & Use app now: https://ncellssa.page.link/hhte

How to teach C programming(day 1)

Image
  In the very first, you have to introduce yourself. Remember one things first impression is last impression. So be confident first shows chambing in your face and also ask introduction, interest towards programming language and basic knowledge towards programming language with Students. Now let’s   begain towards our subjects matter . 1)               1) What is programming language? 2)       2)  How many Types of programming language are there? 3)       3)  What is Scope of “C” programming language? 4)       3)  Why C? 5)       4)  Give basic introduction about Syntax of C programming? 6)       5)  Show output by printing hello World.     Note:-While Giving lecture about try to show learning this programming is more easy than your expectation.

How to write case Study?

Image
  Case study  outlines the success story of the organization .                                                                                         In short, "Zero " To "Hero" stage Explaination. Following is the basic Skills Required :- Explain Case Study like Story Teller. Ready with facts and figures. Give real life examples. Think like marketer. Following should be mention in case Study:- Divide the information in 3 large stage:- Significant challenge. Satisfying solution. Substantial benefits. How to write a case study? Voice of case study should be in general tone and avoid first person perceptions. Be specific with title. Impressive Titles which hold reader attention. clear image of rise and fall Stick timeline to represent information. Atlast give re...

Top Programming language

Image
 Actually there are more than 1000 programming language . Among them following are more Tranding and Popular programming language:- Python JavaScript Java C sharp(c#) PHP C++ C R Swift

Tips to improve Coding Skill

Image
 From the real time Experience of Rocky, We get following Tips:- Study Algorithms and Data Structure in confidently. Read other code. participate in competitive programming. like:-Hackerrank, codechef etc. Explore other language parallelly. finally build projects.