bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

P030.c (1200B)


      1 /*
      2  * Author  : Amit Dutta <amitdutta4255@gmail.com>
      3  * Date    : 12 Dec 2025
      4  * Repo    : https://github.com/notamitgamer/bsc
      5  * License : MIT License (See the LICENSE file for details)
      6  */
      7 
      8 /* Display the first 15 terms of the series. */
      9 
     10 #include <stdio.h>
     11 #include <math.h>
     12 
     13 int main()
     14 {
     15     int i, r;
     16 
     17     // 3, 6, 9, 12, ...
     18     {
     19         i = 3, r = 0;
     20         printf("Series 1 (3, 6, 9, 12, ...) :");
     21         while (i <= 15)
     22         {
     23             r = r + 3;
     24             printf("  %d", r);
     25             i++;
     26         }
     27     }
     28 
     29     // 1, 4, 9, 16, ...
     30     {
     31         i = 1;
     32         printf("\nSeries 2 (1, 4, 9, 16, ...) :");
     33         while (i <= 15)
     34         {
     35             printf("  %d", i * i);
     36             i++;
     37         }
     38     }
     39 
     40     // 4, 8, 16, 32, ...
     41     {
     42         i = 1, r = 2;
     43         printf("\nSeries 3 (4, 8, 16, 32, ...) :");
     44         while (i <= 15)
     45         {
     46             r = r * 2;
     47             printf("  %d", r);
     48             i++;
     49         }
     50     }
     51 
     52     // 0, 7, 26, ...
     53     {
     54         i = 1, r;
     55         printf("\nSeries 4 (0, 7, 26, ...) :");
     56         while (i <= 15)
     57         {
     58             r = (int)pow(i, 3) - 1;
     59             printf("  %d", r);
     60             i++;
     61         }
     62     }
     63 
     64     return 0;
     65 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror