Você está na página 1de 18

9/2/2017 C programming Interview questions and answers: ADDITION & SUBTRACTION OF TWO COMPLEX NUMBERS USING C PROGRAM

C programming Interview questions and answers


C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays st
recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Ar
series factorial palindrome code programs examples on c++ tutorials and pdf

C tutorial C Programming Questions C Interview Questions C Programs C Test C programming pdf Program of c++ Sql Server

C QUESTIONS AND ANSWERS


ADDITION & SUBTRACTION OF TWO COMPLEX NUMBERS USING C PROGRAM
C program examples

C interview questions and answers C code:


1. Adding two complex numbers in c
Data type questions
2. C program for addition of two complex numbers
Variable naming rule questions 3. C program to add two complex numbers
Operators questions

Control flow questions #include<stdio.h>


int main(){
Switch case questions
int a,b,c,d,x,y;
Looping questions printf("\nEnter the first complex number:");
scanf("%d%d",&a,&b);
Pointer questions
printf("\nEnter the second complex number:");
String questions scanf("%d%d",&c,&d);
Printf,Scanf questions
if(b<0)
printf("%d-i\n",a-b);
Preprocessor questions else
Structure questions printf("d+i\n",a+b);
if(d<0)
Commad line argument
printf("d-i\n",c-d);
C questions in Linux else
printf("%d+i\n",c+d);
C online test
printf("\nADDITION ");
C mixed practice sets x=a+c;
C tricky questions
y=b+d;
if(y>0)
Example of recursion in c printf("%d-i%d",x,-y);
C programming forums else
printf("%d+i%d",x,+y);
C TUTORIAL
printf("\n\nSUBTRACTION ");
x=a-c;
Memory mapping tutorial in c y=b-d;
Variables tutorial in c if(y<0)
printf("%d-i%d",x,-y);
Data types tutorial in c
else
Storage classes tutorial in c printf("%d+i%d",x,+y);
return 0;
Looping tutorial in c
}
Pointers tutorial in c

Function tutorial in c

Array tutorial in c
11 comments:
Preprocessor tutorial in c
priya said...
Advanced c tutorial
Does multiplication of complex number programing diifers from addition ? since it leads to squaring of
variable whats the logic of program.
POPULAR POSTS
11/2/08, 1:44 PM
C program examples | Interview
Complete List
Pard said...
C interview questions and answers
if(b<0) x="a+c;" y="b+d;">0)
Find out the perfect number using c
program
doesnt work?
Check the given number is armstrong
number or not using c program "nonportable pointer conversion"

http://www.cquestions.com/2008/01/write-c-program-to-find-addition.html 1/3
9/2/2017 C programming Interview questions and answers: Complex numbers program in c

C programming Interview questions and answers


C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays st
recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Ar
series factorial palindrome code programs examples on c++ tutorials and pdf

C tutorial C Programming Questions C Interview Questions C Programs C Test C programming pdf Program of c++ Sql Server

C QUESTIONS AND ANSWERS


Complex numbers program in c
C program examples

C interview questions and answers

Data type questions

Variable naming rule questions

Operators questions

Control flow questions


Complex numbers definition

Switch case questions Complex numbers are two dimensional numbers i.e. it consists
real part and imaginary part.
Looping questions
Complex numbers are written as a + ib
Pointer questions Where a and b are real numbers and i2 = -1
String questions
Code 1:
Printf,Scanf questions 1. How to use complex numbers in c
Preprocessor questions
2. C language complex numbers

Structure questions #include<stdio.h>


int main(){
Commad line argument
int a,b;
C questions in Linux
printf("Enter any complex number in the format a+ib: ");
C online test
scanf("%d+i%d",&a,&b);
C mixed practice sets
printf("Real part is: %d",a );
C tricky questions printf("\nImaginary part is: %d",b);
Example of recursion in c
return 0;
C programming forums
}
C TUTORIAL

Memory mapping tutorial in c Code 2:


1. C program to printf complex numbers
Variables tutorial in c

Data types tutorial in c


#include<stdio.h>
int main(){
Storage classes tutorial in c int a,b;
Looping tutorial in c
printf("Enter the real part of complex number: ");
Pointers tutorial in c scanf("%d",&a);
Function tutorial in c
printf("Enter the imaginary part of complex number: ");
Array tutorial in c scanf("%d",&b);
Preprocessor tutorial in c printf("\nComplex number is: %d%+di",a,b );
Advanced c tutorial
return 0;
POPULAR POSTS }
C program examples | Interview
Complete List Operation on complex numbers:

C interview questions and answers Addition of complex number


(a + ib) + (c + id) = (a+c) + i(b+d)
Find out the perfect number using c
program Subtraction of complex numbers
Check the given number is armstrong
(a + ib) -(c + id) = (a+c) + i(b-d)
number or not using c program

http://www.cquestions.com/2011/09/complex-numbers-program-in-c.html 1/2
9/2/2017 C programming Interview questions and answers: Complex numbers program in c
Multiplication of complex numbers
QUICK SORT USING C PROGRAM
(a + ib) *(c + id) = (ac-bd) + i(bc+ad)
Check given number is prime number or
not using c program Divison of complex numbers
(a + ib) / c + id) = ((ac + bd) + i(bc-ad))/(c2 + d2)
C questions answers

Write a c program to find out sum of digit


of given number

MULTIPLICATION OF TWO MATRICES


USING C PROGRAM Alogrithm:
Write a c program to check given
number is strong number or not.

C PROGRAMMING QUESTIONS AND


ANSWER
C questions and answers
C interview questions and answers 1. Write a c program to convert decimal number to hexadecimal number.
Pointers to pointers in c programming
language
2. Write a c program to convert decimal number to octal number.
Debugging questions in c with answers
3. Write a c program to convert octal number to decimal number.
Aptitude questions and answers in c 4. Write a c program to convert octal number to hexadecimal number.
5. Write a c program to convert hexadecimal number to decimal number.
There was an error in this gadget
6. Write a c program to convert hexadecimal number to octal number.
7. Write a c program to convert binary number to decimal number.
8. Write a c program to convert binary number to hexadecimal number.
9. Write a c program to convert binary number to octal number.
10. Write a c program to convert decimal number to binary number.
11. Write a c program to convert hexadecimal number to binary number.
12. Write a c program to convert octal number to binary number.
13. Write a c program to convert farehnite to centigrade.
14. Write a c program to convert centigrade to fahrenheit.
15. Big list of c program examples

No comments:
Post a Comment

Links to this post


Create a Link

Newer Post Home Older Post

Subscribe to: Post Comments (Atom)

Copyright@Priyanka. Picture Window theme. Powered by Blogger.

http://www.cquestions.com/2011/09/complex-numbers-program-in-c.html 2/2
9/2/2017 C programming Interview questions and answers: Find g.c.d of two number using c program

C programming Interview questions and answers


C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays st
recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Ar
series factorial palindrome code programs examples on c++ tutorials and pdf

C tutorial C Programming Questions C Interview Questions C Programs C Test C programming pdf Program of c++ Sql Server

C QUESTIONS AND ANSWERS


Find g.c.d of two number using c program
C program examples

C interview questions and answers


Definition of HCF (Highest common factor):
Data type questions

Variable naming rule questions HFC is also called greatest common divisor (gcd). HCF of two
numbers is a largest positive numbers which can divide both
Operators questions
numbers without any remainder. For example HCF of two numbers
Control flow questions 4 and 8 is 2 since 2 is the largest positive number which can
dived 4 as well as 8 without a remainder.
Switch case questions

Looping questions Logic of HCF or GCD of any two numbers:


Pointer questions In HCF we try to find any largest number which can divide both
String questions the number.
For example: HCF or GCD of 20 and 30
Printf,Scanf questions
Both number 20 and 30 are divisible by 1, 2,5,10.
Preprocessor questions HCF=max (1, 2, 3, 4, 10) =10
Structure questions Logic for writing program:
Commad line argument
It is clear that any number is not divisible by greater than
C questions in Linux number itself. In case of more than one numbers, a possible
C online test
maximum number which can divide all of the numbers must be
minimum of all of that numbers.
C mixed practice sets
For example: 10, 20, and 30
C tricky questions
Min (10, 20, 30) =10 can divide all there numbers. So we will
Example of recursion in c take one for loop which will start form min of the numbers and
C programming forums
will stop the loop when it became one, since all numbers are
divisible by one. Inside for loop we will write one if
conditions which will check divisibility of both the numbers.
C TUTORIAL
Program:
Memory mapping tutorial in c

Variables tutorial in c Write a c program for finding gcd (greatest common divisor) of
Data types tutorial in c
two given numbers

Storage classes tutorial in c

Looping tutorial in c
#include<stdio.h>

Pointers tutorial in c int main(){


Function tutorial in c
int x,y,m,i;
Array tutorial in c

Preprocessor tutorial in c printf("Insert any two number: ");


Advanced c tutorial
scanf("%d%d",&x,&y);
if(x>y)
POPULAR POSTS
m=y;
C program examples | Interview else
Complete List
m=x;
C interview questions and answers
for(i=m;i>=1;i--){
Find out the perfect number using c if(x%i==0&&y%i==0){
program
printf("\nHCF of two number is : %d",i) ;
Check the given number is armstrong break;
number or not using c program }
http://www.cquestions.com/2008/01/write-c-program-to-find-gcd-of-two.html 1/14
9/2/2017 C programming Interview questions and answers: Find g.c.d of two number using c program
}
QUICK SORT USING C PROGRAM
return 0;
Check given number is prime number or }
not using c program

C questions answers Other logic : HCF (Highest common factor) program with two
Write a c program to find out sum of digit
numbers in c
of given number

MULTIPLICATION OF TWO MATRICES


USING C PROGRAM #include<stdio.h>
Write a c program to check given
int main(){
number is strong number or not. int n1,n2;
printf("\nEnter two numbers:");
scanf("%d %d",&n1,&n2);
C PROGRAMMING QUESTIONS AND
ANSWER while(n1!=n2){
C questions and answers
if(n1>=n2-1)
n1=n1-n2;
C interview questions and answers
else
Pointers to pointers in c programming
language n2=n2-n1;
Debugging questions in c with answers
}
printf("\nGCD=%d",n1);
Aptitude questions and answers in c
return 0;
}
There was an error in this gadget

HCF program with multiple numbers in c

#include<stdio.h>
int main(){
int x,y=-1;
printf("Insert numbers. To exit insert zero: ");

while(1){
scanf("%d",&x);
if(x<1)
break;
else if(y==-1)
y=x;
else if (x<y)
y=gcd(x,y);
else
y=gcd(y,x);
}

printf("GCD is %d",y);

return 0;
}

int gcd(int x,int y){


int i;
for(i=x;i>=1;i--){
if(x%i==0&&y%i==0){
break;
}
}
return i;
}

1. Write a c program to find out L.C.M. of two numbers.


2. Write a c program to find out H.C.F. of two numbers.
3. Write a c program to find out G.C.D. of two numbers.
4. Big list of c program examples

65 comments:
Anonymous said...

http://www.cquestions.com/2008/01/write-c-program-to-find-gcd-of-two.html 2/14
9/2/2017 C programming Interview questions and answers: Find g.c.d of two number using c program

C programming Interview questions and answers


C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays st
recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Ar
series factorial palindrome code programs examples on c++ tutorials and pdf

C tutorial C Programming Questions C Interview Questions C Programs C Test C programming pdf Program of c++ Sql Server

C QUESTIONS AND ANSWERS


Find g.c.d of two number using c program
C program examples

C interview questions and answers


Definition of HCF (Highest common factor):
Data type questions

Variable naming rule questions HFC is also called greatest common divisor (gcd). HCF of two
numbers is a largest positive numbers which can divide both
Operators questions
numbers without any remainder. For example HCF of two numbers
Control flow questions 4 and 8 is 2 since 2 is the largest positive number which can
dived 4 as well as 8 without a remainder.
Switch case questions

Looping questions Logic of HCF or GCD of any two numbers:


Pointer questions In HCF we try to find any largest number which can divide both
String questions the number.
For example: HCF or GCD of 20 and 30
Printf,Scanf questions
Both number 20 and 30 are divisible by 1, 2,5,10.
Preprocessor questions HCF=max (1, 2, 3, 4, 10) =10
Structure questions Logic for writing program:
Commad line argument
It is clear that any number is not divisible by greater than
C questions in Linux number itself. In case of more than one numbers, a possible
C online test
maximum number which can divide all of the numbers must be
minimum of all of that numbers.
C mixed practice sets
For example: 10, 20, and 30
C tricky questions
Min (10, 20, 30) =10 can divide all there numbers. So we will
Example of recursion in c take one for loop which will start form min of the numbers and
C programming forums
will stop the loop when it became one, since all numbers are
divisible by one. Inside for loop we will write one if
conditions which will check divisibility of both the numbers.
C TUTORIAL
Program:
Memory mapping tutorial in c

Variables tutorial in c Write a c program for finding gcd (greatest common divisor) of
Data types tutorial in c
two given numbers

Storage classes tutorial in c

Looping tutorial in c
#include<stdio.h>

Pointers tutorial in c int main(){


Function tutorial in c
int x,y,m,i;
Array tutorial in c

Preprocessor tutorial in c printf("Insert any two number: ");


Advanced c tutorial
scanf("%d%d",&x,&y);
if(x>y)
POPULAR POSTS
m=y;
C program examples | Interview else
Complete List
m=x;
C interview questions and answers
for(i=m;i>=1;i--){
Find out the perfect number using c if(x%i==0&&y%i==0){
program
printf("\nHCF of two number is : %d",i) ;
Check the given number is armstrong break;
number or not using c program }
http://www.cquestions.com/2008/01/write-c-program-to-find-gcd-of-two.html 1/14
9/2/2017 C programming Interview questions and answers: Find g.c.d of two number using c program
}
QUICK SORT USING C PROGRAM
return 0;
Check given number is prime number or }
not using c program

C questions answers Other logic : HCF (Highest common factor) program with two
Write a c program to find out sum of digit
numbers in c
of given number

MULTIPLICATION OF TWO MATRICES


USING C PROGRAM #include<stdio.h>
Write a c program to check given
int main(){
number is strong number or not. int n1,n2;
printf("\nEnter two numbers:");
scanf("%d %d",&n1,&n2);
C PROGRAMMING QUESTIONS AND
ANSWER while(n1!=n2){
C questions and answers
if(n1>=n2-1)
n1=n1-n2;
C interview questions and answers
else
Pointers to pointers in c programming
language n2=n2-n1;
Debugging questions in c with answers
}
printf("\nGCD=%d",n1);
Aptitude questions and answers in c
return 0;
}
There was an error in this gadget

HCF program with multiple numbers in c

#include<stdio.h>
int main(){
int x,y=-1;
printf("Insert numbers. To exit insert zero: ");

while(1){
scanf("%d",&x);
if(x<1)
break;
else if(y==-1)
y=x;
else if (x<y)
y=gcd(x,y);
else
y=gcd(y,x);
}

printf("GCD is %d",y);

return 0;
}

int gcd(int x,int y){


int i;
for(i=x;i>=1;i--){
if(x%i==0&&y%i==0){
break;
}
}
return i;
}

1. Write a c program to find out L.C.M. of two numbers.


2. Write a c program to find out H.C.F. of two numbers.
3. Write a c program to find out G.C.D. of two numbers.
4. Big list of c program examples

65 comments:
Anonymous said...

http://www.cquestions.com/2008/01/write-c-program-to-find-gcd-of-two.html 2/14
9/2/2017 C programming Interview questions and answers: Write a c program to find out L.C.M. of two numbers.

C programming Interview questions and answers


C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays st
recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Ar
series factorial palindrome code programs examples on c++ tutorials and pdf

C tutorial C Programming Questions C Interview Questions C Programs C Test C programming pdf Program of c++ Sql Server

C QUESTIONS AND ANSWERS


Write a c program to find out L.C.M. of two numbers.
C program examples

C interview questions and answers

Data type questions

Variable naming rule questions


LCM program in c with two numbers :
Operators questions
#include<stdio.h>
Control flow questions
int main(){
Switch case questions int n1,n2,x,y;
Looping questions
printf("\nEnter two numbers:");
scanf("%d %d",&n1,&n2);
Pointer questions x=n1,y=n2;
String questions while(n1!=n2){
if(n1>n2)
Printf,Scanf questions
n1=n1-n2;
Preprocessor questions else
n2=n2-n1;
Structure questions
}
Commad line argument printf("L.C.M=%d",x*y/n1);
C questions in Linux
return 0;
}
C online test

C mixed practice sets


LCM program in c with two numbers (Other logic) :

C tricky questions

Example of recursion in c
#include<stdio.h>
C programming forums
int lcm(int,int);
C TUTORIAL
int main(){
Memory mapping tutorial in c

Variables tutorial in c

Data types tutorial in c


int a,b,l;
Storage classes tutorial in c
printf("Enter any two positive integers ");
Looping tutorial in c
scanf("%d%d",&a,&b);
Pointers tutorial in c

Function tutorial in c
if(a>b)
l = lcm(a,b);
Array tutorial in c else
Preprocessor tutorial in c l = lcm(b,a);
Advanced c tutorial
printf("LCM of two integers is %d",l);

POPULAR POSTS return 0;


}
C program examples | Interview
Complete List
int lcm(int a,int b){
C interview questions and answers
int temp = a;
Find out the perfect number using c
program
while(1){
Check the given number is armstrong
if(temp % b == 0 && temp % a == 0)
number or not using c program break;
http://www.cquestions.com/2010/06/write-c-program-to-find-out-lcm-of-two.html 1/7
9/2/2017 C programming Interview questions and answers: Write a c program to find out L.C.M. of two numbers.
temp++;
QUICK SORT USING C PROGRAM
}
Check given number is prime number or
not using c program return temp;
}
C questions answers

Write a c program to find out sum of digit


LCM program in c with multiple numbers :
of given number

MULTIPLICATION OF TWO MATRICES


USING C PROGRAM

Write a c program to check given #include<stdio.h>


number is strong number or not.
int lcm(int,int);

C PROGRAMMING QUESTIONS AND


ANSWER
int main(){
C questions and answers
C interview questions and answers
Pointers to pointers in c programming int a,b=1;
language
printf("Enter positive integers. To quit press zero.");
Debugging questions in c with answers
Aptitude questions and answers in c while(1){
scanf("%d",&a);
There was an error in this gadget
if(a<1)
break;
else if(a>b)
b = lcm(a,b);
else
b = lcm(b,a);
}

printf("LCM is %d",b);

return 0;
}

int lcm(int a,int b){

int temp = a;

while(1){
if(temp % b == 0 && temp % a == 0)
break;
temp++;
}

return temp;
}

Definition of LCM (Least common multiple):

LCM of two integers is a smallest positive integer which is


multiple of both integers that it is divisible by the both of
the numbers.
For example: LCM of two integers 2 and 5 is 10 since 10 is
the smallest positive numbers which is divisible by both 2
and 5.

1. Write a c program to find out L.C.M. of two numbers.


2. Write a c program to find out H.C.F. of two numbers.
3. Write a c program to find out G.C.D. of two numbers.
4. Big list of c program examples

24 comments:

http://www.cquestions.com/2010/06/write-c-program-to-find-out-lcm-of-two.html 2/7
9/2/2017 C programming Interview questions and answers: C program to find out the sum of infinite G.P. series: geometric progression

C programming Interview questions and answers


C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays st
recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Ar
series factorial palindrome code programs examples on c++ tutorials and pdf

C tutorial C Programming Questions C Interview Questions C Programs C Test C programming pdf Program of c++ Sql Server

C QUESTIONS AND ANSWERS


C program to find out the sum of infinite G.P. series: geometric progression
C program examples

C interview questions and answers Sum of infinite GP series in c programming language


Data type questions #include<stdio.h>
Variable naming rule questions
int main(){
Operators questions
float a,r;
Control flow questions
float sum=0;
Switch case questions
printf("Enter the first number of the G.P. series: ");
Looping questions scanf("%f",&a);
Pointer questions
printf("Enter the common ratio of G.P. series: ");
String questions scanf("%f",&r);
Printf,Scanf questions
if(1 > r)
Preprocessor questions sum = a/(1-r);
else
Structure questions
sum = a/(r-1);
Commad line argument
printf("\nSum of the infinite G.P. series: %f",sum);
C questions in Linux

C online test return 0;


}
C mixed practice sets

C tricky questions
Sample output:

Example of recursion in c Enter the first number of the G.P. series: 1


Enter the common ratio of G.P. series: .5
C programming forums
Sum of the infinite G.P. series: 2.000000
C TUTORIAL
Enter the first number of the G.P. series: 5
Memory mapping tutorial in c
Enter the common ratio of G.P. series: 2
Variables tutorial in c
Sum of the infinite G.P. series: 5.000000
Data types tutorial in c

Storage classes tutorial in c Definition of geometric progression (G.P.):


Looping tutorial in c A series of numbers in which ratio of any two consecutive
Pointers tutorial in c numbers is always a same number that is constant. This constant
is called as common ratio.
Function tutorial in c

Array tutorial in c
Example of G.P. series:

Preprocessor tutorial in c 2 4 8 16 32 64
Advanced c tutorial Here common difference is 2 since ratio any two consecutive
numbers for example 32 / 16 or 64/32 is 2.
POPULAR POSTS
Sum of G.P. series:
C program examples | Interview Sn =a(1–rn+1)/(1-r)
Complete List

C interview questions and answers


Tn term of G.P. series:

Find out the perfect number using c Tn = arn-1


program
Sum of infinite G.P. series:
Check the given number is armstrong
number or not using c program

http://www.cquestions.com/2011/07/write-c-program-to-find-out-sum-of_5747.html 1/2
9/2/2017 C programming Interview questions and answers: C program to find out the sum of infinite G.P. series: geometric progression
Sn = a/(1-r) if 1 > r
QUICK SORT USING C PROGRAM
= a/(r-1) if r > 1
Check given number is prime number or
not using c program 1. Write a c program to find out the sum of series 1 + 2 + …. + n.
2. Write a c program to find out the sum of series 1^2 + 2^2 + …. + n^2.
C questions answers 3. Write a c program to find out the sum of series 1^3 + 2^3 + …. + n^3.
4. Write a c program to find out the sum of given A.P.
Write a c program to find out sum of digit
5. Write a c program to find out the sum of given G.P.
of given number
6. Write a c program to find out the sum of given H.P.
MULTIPLICATION OF TWO MATRICES 7. Write a c program to find out the sum of series 1 + 2 + 4 + 8 … to infinity.
USING C PROGRAM 8. Big list of c program examples

Write a c program to check given


number is strong number or not.

C PROGRAMMING QUESTIONS AND


No comments:
ANSWER
Post a Comment
C questions and answers
C interview questions and answers Links to this post
Pointers to pointers in c programming Create a Link
language
Debugging questions in c with answers
Aptitude questions and answers in c
Newer Post Home Older Post
There was an error in this gadget
Subscribe to: Post Comments (Atom)

Copyright@Priyanka. Picture Window theme. Powered by Blogger.

http://www.cquestions.com/2011/07/write-c-program-to-find-out-sum-of_5747.html 2/2
9/2/2017 C programming Interview questions and answers: Write a c program to find out the sum of G.P series

C programming Interview questions and answers


C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays st
recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Ar
series factorial palindrome code programs examples on c++ tutorials and pdf

C tutorial C Programming Questions C Interview Questions C Programs C Test C programming pdf Program of c++ Sql Server

C QUESTIONS AND ANSWERS


Write a c program to find out the sum of G.P series
C program examples

C interview questions and answers


Sum of GP series in c programming language
Data type questions
#include<stdio.h>
Variable naming rule questions
#include<math.h>
Operators questions
int main(){
Control flow questions

Switch case questions


float a,r,i,tn;
int n;
Looping questions float sum=0;
Pointer questions
printf("Enter the first number of the G.P. series: ");
String questions scanf("%f",&a);
Printf,Scanf questions
printf("Enter the total numbers in the G.P. series: ");
Preprocessor questions scanf("%d",&n);
Structure questions printf("Enter the common ratio of G.P. series: ");
Commad line argument scanf("%f",&r);
C questions in Linux sum = (a*(1 - pow(r,n+1)))/(1-r);
C online test tn = a * (1 -pow(r,n-1));

C mixed practice sets printf("tn term of G.P.: %f",tn);


C tricky questions
printf("\nSum of the G.P.: %f",sum);

Example of recursion in c return 0;


}
C programming forums
Sample output:
C TUTORIAL
Enter the first number of the G.P. series: 1
Memory mapping tutorial in c
Enter the total numbers in the G.P. series: 5
Variables tutorial in c Enter the common ratio of G.P. series: 2
tn term of G.P. : 16.000000
Data types tutorial in c
Sum of the G.P. : 63.000000
Storage classes tutorial in c

Looping tutorial in c
Definition of geometric progression (G.P.):

Pointers tutorial in c A series of numbers in which ratio of any two consecutive


numbers is always a same number that is constant. This constant
Function tutorial in c
is called as common ratio.
Array tutorial in c
Example of G.P. series:
Preprocessor tutorial in c

Advanced c tutorial 2 4 8 16 32 64
Here common difference is 2 since ratio any two consecutive
POPULAR POSTS numbers for example 32 / 16 or 64/32 is 2.
C program examples | Interview Sum of G.P. series:
Complete List
Sn =a(1–rn+1)/(1-r)
C interview questions and answers
Tn term of G.P. series:
Find out the perfect number using c
program
Tn = arn-1
Check the given number is armstrong
number or not using c program Sum of infinite G.P. series:
http://www.cquestions.com/2011/07/write-c-program-to-find-out-sum-of-gp.html 1/2
9/2/2017 C programming Interview questions and answers: Write a c program to find out the sum of G.P series

QUICK SORT USING C PROGRAM Sn = a/(1-r) if 1 > r


Check given number is prime number or = a/(r-1) if r > 1
not using c program
1. Write a c program to find out the sum of series 1 + 2 + …. + n.
C questions answers 2. Write a c program to find out the sum of series 1^2 + 2^2 + …. + n^2.
3. Write a c program to find out the sum of series 1^3 + 2^3 + …. + n^3.
Write a c program to find out sum of digit
of given number 4. Write a c program to find out the sum of given A.P.
5. Write a c program to find out the sum of given G.P.
MULTIPLICATION OF TWO MATRICES 6. Write a c program to find out the sum of given H.P.
USING C PROGRAM 7. Write a c program to find out the sum of series 1 + 2 + 4 + 8 … to infinity.
8. Big list of c program examples
Write a c program to check given
number is strong number or not.

C PROGRAMMING QUESTIONS AND


ANSWER 5 comments:
C questions and answers Balaram Manna said...
C interview questions and answers
correct it tn=a*pow(r,n-1) , not tn=a*(1-pow(r,n-1))
Pointers to pointers in c programming
7/19/13, 2:28 AM
language
Debugging questions in c with answers
Aptitude questions and answers in c koushik ahamed said...
u r r8 Manna.
There was an error in this gadget 12/26/14, 10:13 AM

Chandramohan Reddy said...


correct balaram bro

10/1/15, 5:04 PM

ইিতর ( শেষর) গ said...


help full
thanks.
11/29/15, 5:32 PM

Alok Kumar Singh said...


code to print 3,9,27,81,243,729..............
3/10/16, 6:30 PM

Post a Comment

Links to this post


Create a Link

Newer Post Home Older Post

Subscribe to: Post Comments (Atom)

Copyright@Priyanka. Picture Window theme. Powered by Blogger.

http://www.cquestions.com/2011/07/write-c-program-to-find-out-sum-of-gp.html 2/2
9/2/2017 C programming Interview questions and answers: Write a c program to find out the sum of in A.P. series

C programming Interview questions and answers


C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays st
recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Ar
series factorial palindrome code programs examples on c++ tutorials and pdf

C tutorial C Programming Questions C Interview Questions C Programs C Test C programming pdf Program of c++ Sql Server

C QUESTIONS AND ANSWERS


Write a c program to find out the sum of in A.P. series
C program examples

C interview questions and answers C Code:


Data type questions

Variable naming rule questions


#include<stdio.h>
#include<math.h>
Operators questions
int main(){
Control flow questions

Switch case questions int a,d,n,i,tn;


int sum=0;
Looping questions

Pointer questions
printf("Enter the first number of the A.P. series: ");
scanf("%d",&a);
String questions
printf("Enter the total numbers in the A.P. series: ");
Printf,Scanf questions
scanf("%d",&n);
Preprocessor questions
printf("Enter the common difference of A.P. series: ");
Structure questions
scanf("%d",&d);
Commad line argument
sum = ( n * ( 2 * a + ( n -1 ) * d ) )/ 2;
C questions in Linux tn = a + (n-1) * d;
C online test printf("Sum of the series A.P.: ");
C mixed practice sets for(i=a;i<=tn; i= i + d ){
C tricky questions
if (i != tn)
printf("%d + ",i);
Example of recursion in c else
C programming forums printf("%d = %d ",i,sum);
}
C TUTORIAL
return 0;
Memory mapping tutorial in c }
Variables tutorial in c

Data types tutorial in c


Sample output:

Storage classes tutorial in c


Enter the first number of the A.P. series: 1
Looping tutorial in c Enter the total numbers in the A.P. series: 5
Pointers tutorial in c Enter the common difference of A.P. series: 3
Sum of the series: 1 + 4 + 7 + 10 + 13 = 35
Function tutorial in c

Array tutorial in c
Definition of arithmetic progression (A.P.):
Preprocessor tutorial in c

Advanced c tutorial A series of numbers in which difference of any two consecutive


numbers is always a same number that is constant. This constant
POPULAR POSTS
is called as common difference.

C program examples | Interview Example of A.P. series:


Complete List 5 10 15 20 25 …
C interview questions and answers
Here common difference is 5 since difference of any two
Find out the perfect number using c consecutive numbers for example 20 – 15 or 25 -20 is 5.
program
Sum of A.P. series:
Check the given number is armstrong Sn = n/2(2a + (n-1) d)
number or not using c program

http://www.cquestions.com/2011/07/write-c-program-to-find-out-sum-of-in.html 1/2
9/2/2017 C programming Interview questions and answers: Write a c program to find out the sum of in A.P. series

QUICK SORT USING C PROGRAM Tn term of A.P. series:


Check given number is prime number or
not using c program Tn = a + (n-1) d

C questions answers

Write a c program to find out sum of digit


of given number

MULTIPLICATION OF TWO MATRICES


USING C PROGRAM
1. Write a c program to find out the sum of series 1 + 2 + …. + n.
2. Write a c program to find out the sum of series 1^2 + 2^2 + …. + n^2.
Write a c program to check given 3. Write a c program to find out the sum of series 1^3 + 2^3 + …. + n^3.
number is strong number or not.
4. Write a c program to find out the sum of given A.P.
5. Write a c program to find out the sum of given G.P.
6. Write a c program to find out the sum of given H.P.
C PROGRAMMING QUESTIONS AND 7. Write a c program to find out the sum of series 1 + 2 + 4 + 8 … to infinity.
ANSWER 8. Big list of c program examples
C questions and answers
C interview questions and answers
Pointers to pointers in c programming
language
Debugging questions in c with answers
Aptitude questions and answers in c 1 comment:
attrayee said...
There was an error in this gadget it is also not the perfect!
10/16/11, 8:50 PM

Post a Comment

Links to this post


Create a Link

Newer Post Home Older Post

Subscribe to: Post Comments (Atom)

Copyright@Priyanka. Picture Window theme. Powered by Blogger.

http://www.cquestions.com/2011/07/write-c-program-to-find-out-sum-of-in.html 2/2
9/2/2017 C programming Interview questions and answers: Write a c program to find out the sum of series 1 + 2 + …. + n.

C programming Interview questions and answers


C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays st
recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Ar
series factorial palindrome code programs examples on c++ tutorials and pdf

C tutorial C Programming Questions C Interview Questions C Programs C Test C programming pdf Program of c++ Sql Server

C QUESTIONS AND ANSWERS


Write a c program to find out the sum of series 1 + 2 + …. + n.
C program examples

C interview questions and answers


Sum of 1 + 2 + …. + n series in c programming language
Data type questions

Variable naming rule questions #include<stdio.h>


int main(){
Operators questions

Control flow questions


int n,i;
int sum=0;
Switch case questions
printf("Enter the n i.e. max values of series: ");
Looping questions
scanf("%d",&n);
Pointer questions
sum = (n * (n + 1)) / 2;
String questions

Printf,Scanf questions
printf("Sum of the series: ");

Preprocessor questions for(i =1;i <= n;i++){


if (i!=n)
Structure questions
printf("%d + ",i);
Commad line argument else
C questions in Linux
printf("%d = %d ",i,sum);
}
C online test

C mixed practice sets return 0;


}
C tricky questions

Example of recursion in c
Sample output:

C programming forums Enter the n i.e. max values of series: 5


Sum of the series: 1 + 2 + 3 + 4 + 5 = 15
C TUTORIAL
Mathematical Formula:
Memory mapping tutorial in c

Variables tutorial in c

Data types tutorial in c Sum of the series 1 + 2 + 3 + … + n = n (n+1)/2


Storage classes tutorial in c

Looping tutorial in c

Pointers tutorial in c 1. Write a c program to find out the sum of series 1 + 2 + …. + n.


2. Write a c program to find out the sum of series 1^2 + 2^2 + …. + n^2.
Function tutorial in c 3. Write a c program to find out the sum of series 1^3 + 2^3 + …. + n^3.
Array tutorial in c 4. Write a c program to find out the sum of given A.P.
5. Write a c program to find out the sum of given G.P.
Preprocessor tutorial in c 6. Write a c program to find out the sum of given H.P.
7. Write a c program to find out the sum of series 1 + 2 + 4 + 8 … to infinity.
Advanced c tutorial
8. Big list of c program examples

POPULAR POSTS

C program examples | Interview


Complete List
118 comments:
C interview questions and answers
Anonymous said...
Find out the perfect number using c give me solution for below series....
program 0 1 3 6 10 15 21.....n
3/18/13, 10:49 PM
Check the given number is armstrong
number or not using c program

http://www.cquestions.com/2011/07/write-c-program-to-find-out-sum-of.html 1/16
9/2/2017 C programming Interview questions and answers: Write a c program to find out the sum of series 1^2 + 2^2 + …. + n^2.

C programming Interview questions and answers


C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays st
recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Ar
series factorial palindrome code programs examples on c++ tutorials and pdf

C tutorial C Programming Questions C Interview Questions C Programs C Test C programming pdf Program of c++ Sql Server

C QUESTIONS AND ANSWERS


Write a c program to find out the sum of series 1^2 + 2^2 + …. + n^2.
C program examples

C interview questions and answers


Sum of 1^2 + 2^2 + …. + n^2 series in c programming language
Data type questions

Variable naming rule questions #include<stdio.h>


Operators questions int main(){
Control flow questions
int n,i;
Switch case questions int sum=0;
Looping questions printf("Enter the n i.e. max values of series: ");
Pointer questions scanf("%d",&n);
String questions sum = (n * (n + 1) * (2 * n + 1 )) / 6;
Printf,Scanf questions
printf("Sum of the series : ");
Preprocessor questions
for(i =1;i<=n;i++){
Structure questions if (i != n)
Commad line argument printf("%d^2 + ",i);
else
C questions in Linux
printf("%d^2 = %d ",i,sum);
C online test }
C mixed practice sets return 0;
C tricky questions }
Example of recursion in c Sample output:
C programming forums
Enter the n i.e. max values of series: 5
Sum of the series: 1^2 + 2^2 + 3^2 + 4^2 + 5^2 = 55
C TUTORIAL

Memory mapping tutorial in c Mathematical Formula:


Variables tutorial in c
Sum of the series 12 + 22 + 32 + … + n2 =
Data types tutorial in c n (n+1) (2n+1)/6
Storage classes tutorial in c 1. Write a c program to find out the sum of series 1 + 2 + …. + n.
Looping tutorial in c
2. Write a c program to find out the sum of series 1^2 + 2^2 + …. + n^2.
3. Write a c program to find out the sum of series 1^3 + 2^3 + …. + n^3.
Pointers tutorial in c 4. Write a c program to find out the sum of given A.P.
5. Write a c program to find out the sum of given G.P.
Function tutorial in c
6. Write a c program to find out the sum of given H.P.
Array tutorial in c 7. Write a c program to find out the sum of series 1 + 2 + 4 + 8 … to infinity.
8. Big list of c program examples
Preprocessor tutorial in c

Advanced c tutorial

POPULAR POSTS
22 comments:
C program examples | Interview
Complete List preeree said...
thanks...............
C interview questions and answers
12/12/11, 2:02 PM

Find out the perfect number using c


program
Anonymous said...
Check the given number is armstrong
number or not using c program

http://www.cquestions.com/2011/07/write-c-program-to-find-out-sum-of_19.html 1/4
9/2/2017 C programming Interview questions and answers: Write a c program to find out the sum of series 1^3 + 2^3 + …. + n^3

C programming Interview questions and answers


C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays st
recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Ar
series factorial palindrome code programs examples on c++ tutorials and pdf

C tutorial C Programming Questions C Interview Questions C Programs C Test C programming pdf Program of c++ Sql Server

C QUESTIONS AND ANSWERS


Write a c program to find out the sum of series 1^3 + 2^3 + …. + n^3
C program examples

C interview questions and answers Write a c program or code to find out the sum of series 1^3 +
Data type questions 2^3 + …. + n^3 that is sum of cube of n natural numbers.
Variable naming rule questions
#include<stdio.h>
Operators questions #include<math.h>
Control flow questions
int main(){
Switch case questions

Looping questions int n,i;


Pointer questions int sum=0;
String questions
printf("Enter the n i.e. max values of series: ");
Printf,Scanf questions scanf("%d",&n);
Preprocessor questions
sum = pow(((n * (n + 1) ) / 2),2);
Structure questions

Commad line argument printf("Sum of the series : ");


C questions in Linux
for(i =1;i<=n;i++){
C online test
if (i != n)
C mixed practice sets
printf("%d^3 + ",i);
C tricky questions else
Example of recursion in c printf("%d^3 = %d ",i,sum);
C programming forums
}

return 0;
C TUTORIAL
}
Memory mapping tutorial in c

Variables tutorial in c Sample output:


Data types tutorial in c Enter the n i.e. max values of series: 3
Sum of the series: 1^3 + 2^3 + 3^3 = 36
Storage classes tutorial in c

Looping tutorial in c Mathematical Formula:


Pointers tutorial in c Sum of the series 13 + 23 + 33 + … + n3 = (n (n+1)/2)2
Function tutorial in c
1. Write a c program to find out the sum of series 1 + 2 + …. + n.
Array tutorial in c 2. Write a c program to find out the sum of series 1^2 + 2^2 + …. + n^2.
3. Write a c program to find out the sum of series 1^3 + 2^3 + …. + n^3.
Preprocessor tutorial in c
4. Write a c program to find out the sum of given A.P.
Advanced c tutorial 5. Write a c program to find out the sum of given G.P.
6. Write a c program to find out the sum of given H.P.
POPULAR POSTS 7. Write a c program to find out the sum of series 1 + 2 + 4 + 8
C program examples | Interview … to infinity.
Complete List 8. Big list of c program examples
C interview questions and answers
If you have any suggestions on above sum of cube of n natural
Find out the perfect number using c numbers, please share us.
program

Check the given number is armstrong


number or not using c program

http://www.cquestions.com/2011/07/write-c-program-to-find-out-sum-of_8643.html 1/4