Skip to main content

Write a C program to calculate the following series using for loop Sum= 1/3^2 +2/4^3 +3/5^4 + 4/6^5+ ... and print the result along with the series as the given format: when n=4; 1/3^2+2/4^3 +3/5^4+4/6^5 = 0.14768 similarly, print the result according to the nth term.

Write a C program to calculate the following series using for loop Sum= 1/3^2 +2/4^3 +3/5^4 + 4/6^5+ ... and print the result along with the series as the given format:


when n=4; 1/3^2+2/4^3 +3/5^4+4/6^5 = 0.14768


similarly, print the result according to the nth term.


The program is written in the C language , if you know the basics of C language than you can understand the program easily. If you the code for the same question in other language then please do comment for the help of others.


Write a C program to calculate the following series using for loop Sum= 1/3^2 +2/4^3 +3/5^4 + 4/6^5+ ... and print the result along with the series as the given format:  when n=4; 1/3^2+2/4^3 +3/5^4+4/6^5 = 0.14768  similarly, print the result according to the nth term.



This program will support in any C compiler.

//Do follow and subscribe STAR tube
//Comment ...If you guys have any alternate method.

#include <stdio.h>
#include <math.h>
#include <conio.h>

int main()
{
    clrscr;
    int i,n;
    int a=2,b=3;
    float Sum=0;
    scanf("%d",&n);
    printf("when n=%d,",n);
    for(i=1;i<=n;i++)
    {
        Sum = Sum + i/(pow(b,a));
        b++;
        a++;
    }
    for(i=1;i<=n;i++)
    {
        printf("%d%d%d",i,(i+2),(i+1));
        if(i<n){
            printf(" + ");
        }
    }
    printf(" = %f",Sum);
    return 0;
    getch();
}



Write a C program in C that calls User defined function to calculate exponent of a number with following condition.


a. The function named ?getexp? takes two arguments: base number ?b? and the exponent ?n?. The function should calculate (b)n and return the result to main function.


b. Main function reads the base number and the exponent from user. Main function should call the user defined function ?getexp? which returns the result. Display the result in main.


c. Student should not use Built-in function for finding exponent.


The program is written in the C language , if you know the basics of C language than you can understand the program easily. If you the code for the same question in other language then please do comment for the help of others.


Write a C program in C that calls User defined function to calculate exponent of a number with following condition.  a. The function named ?getexp? takes two arguments: base number ?b? and the exponent ?n?. The function should calculate (b)n and return the result to main function.  b. Main function reads the base number and the exponent from user. Main function should call the user defined function ?getexp? which returns the result. Display the result in main.  c. Student should not use Built-in function for finding exponent.



This program will support in any C compiler.

//Do follow and subscribe STAR tube
//Comment ...If you guys have any alternate method.

#include <stdio.h>

int getexp(b,n)
{
    int i;
    int a=b;
    for(i=2;i<=n;i++)
    {
        a = a*b;
    }
    return a;
}
void main()
{
    int ans=0;
    int n,b;
    printf("Enter base number:");
    scanf("%d",&b);
    printf("Enter exponent value:");
    scanf("%d",&n);
    ans = getexp(b,n);
    printf("answer = %d",ans);
}



You are searching for a city in a country and you?re asked to select a country from a choice of three country namely:
India
Spain
UK


Having selected a country you are again provided with a list of city in that country namely:
1. India
a. Mumbai
b. Delhi
2. Spain
a. Madrid
b. Savile
3. UK
a. Bristol
b. bath


Write a C program to implement above using nested switch case statement.


The program is written in the C language , if you know the basics of C language than you can understand the program easily. If you the code for the same question in other language then please do comment for the help of others.


You are searching for a city in a country and you?re asked to select a country from a choice of three country namely: India Spain UK  Having selected a country you are again provided with a list of city in that country namely: 1. India a. Mumbai b. Delhi 2. Spain a. Madrid b. Savile 3. UK a. Bristol b. bath  Write a program to implement above using nested switch case statement.



This program will support in any C compiler.

//Do follow and subscribe STAR tube
//Comment ...If you guys have any alternate method.

#include <stdio.h>
#include <conio.h>

int main()
{
    clrscr;
    int i;
    printf("Select a country\nIndia press 1 \nSpain press 2 \nUK press 3\n");
    scanf("%d",&i);
    switch(i)
    {
        case 1:
        printf("1.India\na.Mumbai\nb.Delhi");
        break;
        
        case 2:
        printf("2.Spain\na.Mandrid\nb.Savile");
        break;
        
        case 3:
        printf("3.UK\na.Bristol\nb.bath");
        break;
    }
    return 0;
    getch();
}


Write a C program to print the following symbol series (front and back slash - 5 times) as given below:


/    / \   / \   / \   / \   \


The program is written in the C language , if you know the basics of C language than you can understand the program easily. If you the code for the same question in other language then please do comment for the help of others.



Write a C program to print the following symbol series (front and back slash - 5 times) as given below:  /    / \   / \   / \   / \   \




This program will support in any C compiler.
//Do follow and subscribe STAR tube
//Comment ...If you guys have any alternate method.

#include <stdio.h>
#include <conio.h>

int main()
{
   clrscr;
   int i,j;

   for(i=0;i<=5;i++)
   {
       if(i==0)
       {
           printf("/");
           printf("\t");
       }
       else if(i==5)
       { 
           printf("\\");
           printf("\t");
       }
       else
       { 
           printf("/");
           printf("\\");

           printf("\t");
       }
   }
    return 0;
    getch();
}



Comments

Popular posts from this blog

NCERT All Chapters Handwritten Notes | Physics Chemistry Best Handwritten Notes | STAR tube Notes

NCERT All Chapters Handwritten Notes | Physics Chemistry Best Handwritten Notes | STAR tube Notes Are you looking for handwritten notes which are easy and simple to understand.Then you are on the right place because here you would get handwritten notes which are very easy to understand. It's not possible to cover whole syllabus and revise it during exam time because you have to revise lots of subjects in very less time. In this case,notes are one of the best option to cover whole syllabus in very short period of time. STAR tube will provide you the Best Handwritten Notes of Class 11 , Class 12 , Btech/Bsc Electrical and Electronics. Follow and Subscribe the STAR tube on  YouTube . Chemistry Handwritten Notes | Class 11 Unit I : Some Basic Concepts of Chemistry   -    PDF Unit II : Structure of Atom   -    PDF Unit III : Classification of Elements and Periodicity in Properties   -    PDF Unit IV : Chemical Bonding and Molecular Structure   -    PDF Unit V : States of Matter: Gas

Classification of Elements & Periodicity in Properties Handwritten Notes | Chemistry Class 11 Chapter 3 | Classification of Elements & Periodicity in Properties Notes for Board Exams | STAR tube Notes

Classification of Elements & Periodicity in Properties Handwritten Notes | Chemistry Class 11 Chapter 3 | Classification of Elements & Periodicity in Properties Notes for Board Exams | STAR tube Notes Chapter 3 Classification of Elements & Periodicity in Properties Classification of Elements & Periodicity in Properties Notes Higher Secondary is the most crucial stage of school education because at this juncture specialized discipline based, content  ‐oriented courses are introduced. Students reach this stage after 10 years of general education and opt for Chemistry with a purpose of pursuing their career in basic sciences or professional courses like medicine, engineering, technology and study courses in applied areas of science and technology at tertiary level. Therefore, there is a need to provide learners with sufficient conceptual background of Chemistry, which will make them competent to meet the challenges of academic and professional courses after the senior seco

Some Basic Concepts of Chemistry Handwritten Notes | Chemistry Class 11 Chapter 1 | Some Basic Concepts of Chemistry Notes for Board Exams | STAR tube Notes

Some Basic Concepts of Chemistry Handwritten Notes | Chemistry Class 11 Chapter 1 | Some Basic Concepts of Chemistry Notes for Board Exams | STAR tube Notes Chapter 1 Some Basics Concepts of Chemistry Some Basic Concepts of Chemistry Best Handwritten Notes Higher Secondary is the most crucial stage of school education because at this juncture specialized discipline based, content  ‐oriented courses are introduced. Students reach this stage after 10 years of general education and opt for Chemistry with a purpose of pursuing their career in basic sciences or professional courses like medicine, engineering, technology and study courses in applied areas of science and technology at tertiary level. Therefore, there is a need to provide learners with sufficient conceptual background of Chemistry, which will make them competent to meet the challenges of academic and professional courses after the senior secondary stage. STAR tube will provide you the Best Handwritten Notes of Class 11 ,