English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
처음 단어 "a", "d"의 공통 차이점 및 수열의 단어 수 "n"이 주어졌을 때. 시퀀스의 n번째 단어를 찾는 작업입니다.
따라서, 이 문제에 대한 프로그램을 작성하는 방법에 대해 논의하기 전에, 우리는 수학적 수열이 무엇인지 알아야 합니다.
arithmetic series or arithmetic sequence is a sequence of numbers in which the difference between two consecutive terms is constant.
like we have the first term,that is a = 5,difference1and the n-th term we are looking for should be3therefore,the series should be:5。6。7、7,so the output must be
。-
therefore,we can say that the n-th term of the arithmetic series will be similar to1 AP1 therefore,we can say that the n-th term of the arithmetic series will be similar to2 AP1 + = a2-1) * d therefore,we can say that the n-th term of the arithmetic series will be similar to3 AP1 + = a3-1) * d (1 + (n-1) *
..APn = a +(n-1)* therefore the formula will be AP = a
nth term will be2, d=1, n=5 Input: a= 6 d. 2, 3, 4, 5, 6 Explanation: The series will be: 6 nth term will be7, d=2, n=3 Input: a= 11
Output:-
we will use to solve the given problem
with the first term A,common difference D and N as the series number. +then by (A-1)* (N
D)calculate the n-th term
algorithm Step 1 -Start > In function int nth_ap(int a, int d, int n) + (n - 1) * d) Step 2 -> int main() Declare and initialize the inputs a=2, d=1, n=5 Print The result obtained from calling the function nth_ap(a,d,n) Stop
#include <stdio.h> int nth_ap(int a, int d, int n) { //use the formula to find //the n-th term t(n)= a(1)+(n-1)* d- return (a + (n - 1) * d); } //main function int main() { //starting number int a = 2; //common point int d = 1; //the Nth noun int n = 5; printf("The %dth term of AP :%d\n", n, nth_ap(a,d,n)); return 0; }
output result
The 5the term of the series is: 6