JSON Variables

Program to convert days into month and days in C language | Tech Arena





In this article, I am going to tell you that how can you create a program to convert days into months and days in C language. It is a very basic and beginners program to create in C language.

Program to convert days into month and days in C language


I am assuming that you all have gone through the basics of the C language because here I am not going to explain every single word in this program. If you are new to the C language then you must refer to the basic knowledge of C language by clicking here.


Still, I will tell you some important keywords in C Language that are used in this program to convert days into months and days.


Also, read- How to Grow your YouTube Channel faster in 2021? Top 5 methods!


Arithmetic Operators In C Language:


"+"   is used for Addition

"- "   is used for Subtraction

"*"    is used for Multiplication

"/ "    is used for Division

"%"   is used for Module Division


Now I will give you the program and its output down below, If you don't have any system to use the compiler on then you should consider online C Compilers that are available on the internet and are free to use on android devices too.


Also, read- What is Google AdSense New Strike Policy? All you need to know



1- Program to convert days into months and days.


#include<stdio.h>


void main()

{

    int months,days;

    printf("\n enter days\n");

    scanf("%d", & days);

    months= days/30;

    days= days%30;

    printf("\n months= %d days= %d",months,days);

  }


Output


Program to convert days into month and days in C language





2- Program to Convert days into years, months, weeks, and days.



#include<stdio.h>


int main()
{
    int months, years, weeks, days;

    printf("\n enter days\n");

    scanf("%d", & days);

    years= days/365;

    weeks= days/7;

    months= days/30;

    days= days%30;

   printf("\n years= %d weeks=%d months= %d days= %d",years,weeks,months,days);

    
}



Output




Program to convert days into month and days in C language


Post a Comment

0 Comments

]