I am going to assume you want a program to print out the Fibonacci series.
#include <stdio.h>
int main(int argc, char **argv)
{
if (argc < 2) {
printf("Usage: %s max\n", argv[0]);
return -1;
}
int a = 1, b = 1, c;
int max = atoi(argv[1]);
printf("%d %d ", a, b);
while (b < max) {
c = a + b;
a = b;
b = c;
if ((b <= max)) printf("%d ", b);
}
printf("\n");
return 0;
}
Chat with our AI personalities
You will be able to understand C programs. Also to write C programs.
A C++ program can be used to write C programs that will display 10 lines of biodata. Many types of C programming can be written with a C++ program.
You don't have to write palindrome programs in wikipedia.
write a program to print the series 1/12+1/22+.........+1/n2 ?
In "real life" as opposed to what? C is a programming language. It's used to write computer programs. It (and variants, like C++ and C#) are used to write probably the majority of programs in use today.