Twitter Facebook Delicious Digg Stumbleupon Favorites More

Thursday, 20 October 2016

Programs in C (in Turbo C) - Snippets-2

Programs in C

(in Turbo C)

Snippets-2

Programs in C (in Turbo C) - Snippets-2


Program 8: Program to get a number from user in float and print the SQUARE OF NUMBER

#include<stdio.h>
#include<conio.h>

main()
{
 float num;
 clrscr();
 printf("Enter the number: \t");
 scanf("%f",&num);
 printf("\n\nThe SQUARE of %f is \t%f",num,num*num);
 getch();
}




Program 9: Program to Perform Arithmetic Operation on Integer Quantities

#include <stdio.h>
#include<conio.h>
main()
{
 int num1,num2;
 clrscr();

 printf("Enter the first number num1 : ");
 scanf("%d",&num1);
 printf("Enter the second number num2 : ");
 scanf("%d",&num2);
 printf("\n\nThe Sum is num1 + num2 \t\t\t %d",num1+num2);
 printf("\n\nThe Subtraction is num1 - num2\t%d",num1-num2);
 printf("\n\nThe Multiplication is num1 * num2 \t %d",num1*num2);
 printf("\n\nThe Division is num1 / num2 \t\t %d",num1/num2);
 getch();
}


Program 10: Program to Perform Arithmetic Operation on One Integer And One Float Quantities


#include <stdio.h>
#include<conio.h>
main()
{
 int num1;
 float num2;

 clrscr();

 printf("Enter an Integer number num1 : ");
 scanf("%d", &num1);
 printf("\nEnter a float number num2 : ");
 scanf("%f", &num2);
 printf("\n num1 + num2 = %10f",num1+num2);
 printf("\n num1 - num2 = %10f",num1-num2);
 printf("\n num1 * num2 = %10f",num1*num2);
 printf("\n num1 / num2 = %10f",num1/num2);
 getch();
}



Program 11: Write a program in C, which can take an integer number Inch and then convert then find out its equivalent in Meters, and in Centimeters.

#include <stdio.h>
#include <conio.h>

main()
{
 float inch,mts,cms;
 clrscr();
 printf("Enter the Input In INCHES :\t");
 scanf("%f",&inch);
 cms = inch * 2.54;
 mts = cms / 100;
 printf("\n%f Inches is equal to %f centimeters",inch,cms);
 printf("\n%f Inches is equal to %f meters",inch,mts);
 getch();
}



Program 12: Program To Print ASCII equivalent of Given Character

#include <stdio.h>
#include <ctype.h>

main()
{
 char ch;
 clrscr();
 printf("Enter the character :");
 scanf("%c",&ch);
 printf("\n\n\nThe ASCII equvilant of %c%d",ch,toascii(ch));
 getch();
}





Share:

0 comments:

Post a Comment

NodeJS Tutorial

NodeJS Tutorial
Developer-Bytes

Maths Resources

Maths Resources
Maths Resources

Buy Books

Buy Books
Buy Books

Geography Quiz

Geography Quiz
Geography Quiz

History MCQs

History MCQs
History Quiz For Competitive exams

Categories

Popular Posts

GooglePlus

Recent Posts

Unordered List

Express Print Zone

Eduvictors Quizzes

Online Quizzes, Study notes for CBSE Class 6 - 12

Text Widget

Compete4Exams

Study notes for Competitive Exams

Developer Bytes

Developer Bytes
Developer Bytes
Powered by Blogger.

Blogger Tutorials

Blogger Templates

Sample Text

Copyright © IP University Musings BCA, MCA, BBA, MBA, BTech Question Papers and Study Notes | Powered by Blogger
Design by SimpleWpThemes | Blogger Theme by NewBloggerThemes.com