Q-27. Write a C program to print all natural numbers from 1 to n using loop.

0
লুপ ব্যবহার করে 1 থেকে n পর্যন্ত সমস্ত প্রাকৃতিক সংখ্যা মুদ্রণ করতে একটি সি প্রোগ্রাম লিখুন।

  1. #include <stdio.h>
  2. int main()
  3. {
  4.     int i, n;

  5.     /*
  6.      * Input a number from user
  7.      */
  8.     printf("Print all natural numbers from 1 to : ");
  9.     scanf("%d", &n);

  10.     /*
  11.      * Print natural numbers from 1 to end
  12.      */
  13.     i=1;
  14.   /  while(i<=n)
  15.     {
  16.         printf("%d\n", i);
  17.         i++;
  18.     }

  19.     return 0;
  20. }




Post a Comment

0Comments
Post a Comment (0)