Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program that shows how to perform explicit cast of a variable

Posted By: Robert Evans     Category: C Programming     Views: 1300

Write a program that shows how to perform explicit cast of a variable.

Code for Program that shows how to perform explicit cast of a variable in C Programming

#include<stdio.h>
#include<conio.h>
void main()
{
  float sum;
  int n;
  clrscr();
  sum = 0;
  for(n = 1;n<=10;++n)
  {
     sum = sum + 1/(float)n;
     printf("%2d %6.4f\n",n,sum);
   }

getch();
}
  
Share: 



Robert Evans
Robert Evans author of Program that shows how to perform explicit cast of a variable is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!