#include(stdio.h) // place this '<' & '>' instead of '(' & ')' before stdio.h
#include(conio.h)
#include(math.h)
int main( )
{
int x, n, sum,power;
clrscr( );
printf("Enter the values of x and n:");
scanf("%d%d", &x, &n);
if(n<0 style="font-weight: bold; color: rgb(255, 0, 0);">
{
printf("\nSorry, the formula does not make sense for negative exponents & values");
printf("Enter the values of x and n:");
scanf("%d%d", &x, &n);
sum=1;
for(power=1; power <=n; power++) {
sum=sum+ pow(x,power); }
printf("X value is: %d \nN value is: %d", x, n);
printf("\nSum of the given geometric progression: %d", sum);
}
else
{
sum=1;
for(power=1; power <=n; power++) {
sum=sum+ pow(x,power); }
printf("X value is: %d \nN value is: %d", x, n);
printf("\nSum of the given geometric progression: %d", sum);
}
getch( );
return 0;
}
write a vb program to find the magic square
Write a program to find the grade obtained by the students of a class
what is if(!(str[i]==32))
#include<stdio.h>
Write a program in c++ that take input in a integer matrix of size 4*4 and find out if the entered matrix is diagonal or not.
Divide any term, except the first, by the term before it.
It is not possible to answer this question without information on whether the terms are of an arithmetic or geometric (or other) progression, and what the starting term is.
write a vb program to find the magic square
For first find an example program.
Write a program to find the grade obtained by the students of a class
Yes, do write. That's what you always have to do when you have got a homework-program.
write an assembly language program to find sum of N numbers
t(1) = a = 54 t(4) = a*r^3 = 2 t(4)/t(1) = r^3 = 2/54 = 1/27 and so r = 1/3 Then sum to infinity = a/(1 - r) = 54/(1 - 1/3) = 54/(2/3) = 81.
Write a c program to compute the surface area and volume of a cube
The sum to infinity of a geometric series is given by the formula Sβ=a1/(1-r), where a1 is the first term in the series and r is found by dividing any term by the term immediately before it.
program to find maximum of two numbers using pointers
bgfygfrhjyuyhh