about-text

SoftOSet is the most remarkable programming site. SoftOSet provides the fresh conceptual and professional programs, articles, books, and other interesting and technical writings. SoftOSet is the most reliable programming site to learn the programs and the basics of the popular programming languages. SoftOSet is the hub of the informative and research based articles.

Centigrade to Fahrenheit Conversion and Leap Year Program in C and C++

 

 

 

Convert Centigrade to Fahrenheit or find Year is Leap or not. These are the programs which the beginner level learners often learn so that their basics concepts became clear and they go deep easily in the ocean of coding.

So we have decided to develop a program which performs both tasks.

  • o   Convert Centigrade to Fahrenheit
  • o   Find year is Leap or Not

In a single program, we will perform this practice first using the C++ language and then C language.



 

Centigrade to Fahrenheit Conversion and Leap Year Program in C++


This code is the C++ version of this program.



Code

//Date 31 january,2019;

//program to convert farenhite/centigrade and to find leap year

#include<iostream>

using namespace std;

int main()

{

      int tf,tc;

      cout<<"Enter the tempreature in Centigrade:";

      cin>>tc;

      cout<<endl;

      tf=(tc*9/5)+32;

      cout<<"Tempreature in Centigrades :"<<tf;

      cout<<"\n********************************************************************************\n";

      int year;

      cout<<"\nEnter the Year to Find it is leap or Not\n";

      cin>>year;

      if(year%4==0)

      cout<<"The Year "<<year<<"is a Leap Year\n";

      else

                  cout<<"The Year "<<year<<"is Not a Leap Year\n";

                  return 0;

}




Output

Here is the sample run of this code.

 

 

 

 

 

Centigrade to Fahrenheit Conversion and Leap Year Program in C language


This code is the C version of this program.


Code


//Date 31 january,2019;

//program to convert farenhite/centigrade and to find leap year

#include<stdio.h>

int main()

{

      int tf,tc;

      printf("Enter the tempreature in Centigrade:");

scanf("%d",&tc);

      printf("\n");

      tf=(tc*9/5)+32;

      printf("Tempreature in Farenhite :%d",tf);

      printf("\n********************************************************************************\n");

      int year;

      printf("\nEnter the Year to Find it is leap or Not\n");

scanf("%d",&year);

      if(year%4==0)

      printf("The Year %d is a Leap Year\n",year);

      else

                  printf("The Year %d is Not a Leap Year\n",year);

                  return 0;

}

 

Output


Here is the sample run of this code.



 

Conclusion


The only thing to be concludes here is that a single program can perform more than one task. So, the multitasking is allowed. Second important thing is that both programs of C language and the C++ language are giving the same output.

 

Thanks for Learning from here. If fall in any bug while running this code ask us for help. We will help you to fix your errors.


Post a Comment

Feel Free to Comment Us

Previous Post Next Post

Recents