100% found this document useful (1 vote)
23 views10 pages

GLFW Input Handling Examples

The document contains 17 programming problems with sample inputs and outputs. Each problem has the goal of writing a C program to produce the given output when provided the input code. The problems cover basic concepts like printing text, calculations, conditional statements, data type conversions and more. A blog link is provided at the top and bottom for more programming problems.

Uploaded by

njpatel9
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
23 views10 pages

GLFW Input Handling Examples

The document contains 17 programming problems with sample inputs and outputs. Each problem has the goal of writing a C program to produce the given output when provided the input code. The problems cover basic concepts like printing text, calculations, conditional statements, data type conversions and more. A blog link is provided at the top and bottom for more programming problems.

Uploaded by

njpatel9
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

For More programs visit

[Link]
com

PROGRAME:-1
Write a programe for following output.
Output:-
Hello world
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
int a;
clrscr( );
printf("Hello world");
getch( );
}

PROGRAME:-2
Write a programe for following output.
Output:-
Hello worldHow are you?
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
int a;
clrscr( );
printf("Hello world");

Visit [Link]
printf("How are you?");
getch( );
}

PROGRAME:-3
Write a programe for following output.
Output:-
Hello worldHow are you?
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
int a;
clrscr( );
printf("Hello world");
printf("\nHow are you?");
getch( );
}

PROGRAME:-4
Write a programe for following output.
Output:-
Hello world How are you?
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
clrscr( );
printf("Hello world");
printf("\tHow are you?");
getch( );
}

PROGRAME:-5
Write a programe for print your address in center of output screen.
Input:-
Visit [Link]
#include<stdio.h>
#include<conio.h>
void main( )
{
clrscr( );
printf("\n\t\t\tPatel Ankit");
printf("\n\t\t\t12\Sardar Bunglows");
printf("\n\t\t\tShivaji chowk, Shahibagh");
printf("\n\t\t\tAhmedabad");
getch( );
}
Output:-
Output will be print in centre of screen.

PROGRAME:-6
Write a programe for calculation of addition, sub, multy, div of given
two number.
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
int a,b,c;
float d;
clrscr( );
printf("Enter first no: ");
scanf("%d",&a);
printf("Enter second no: ");
scanf("%d",&b);
c=a+b;
printf("\nAddition=%d",c);
c=a-b;
printf("\nSubstraction=%d",c);
c=a*b;
printf("\nMultiplication=%d",c);
c=a%b;
printf("\nModulow=%d",c);
d=a/b;
printf("\nDivision=%2.2f",d);
getch( );
}

Visit [Link]
Output:-
Enter first no: 50
Enter second no: 4

Addition=54
Substraction=46
Multiplication=200
Modulow=2
Division=12
PROGRAME:-7
Write a programe convert rupees into [Link]:-1 rupee=100 paisa.
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
int p;
float r;
clrscr( );
printf("\nEnter rupees= ");
scanf("%f",&r);
p=100*r;
printf("\nPaisa=%d",p);
getch( );
}
Output:-
Enter rupees= 4.4

Paisa=440

PROGRAME:-8
Write a programe convert Character into its ASCII value.
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
char c;
clrscr( );

Visit [Link]
printf("Enter Character: ");
scanf("%c",&c);
printf("Character %c 's ASCII no=%d",c,c);
getch( );
}
Output:-
Enter Character: N
Character N 's ASCII no=78

PROGRAME:-9
Write a programe convert rupees ASCII no into related character.
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
int n;
clrscr( );
printf("Enter ASCII no:");
scanf("%d",&n);
printf("ASCII no %d is for character %c",n,n);
getch( );
}
Output:-
Enter ASCII no:97
ASCII no 97 is for character a

PROGRAME:-10
Write a programe for find area of circle by given radius .
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
float r,a;
clrscr( );
printf("Enter radius of circle: ");
scanf("%f",&r);
a=3.14*r*r;

Visit [Link]
printf("Area of circle=%2.2f",a);
getch( );
}
Output:-
Enter radius of circle: 3
Area of circle=28.26

PROGRAME:-11
Write a programe for find diagonal of rectangle by length & width.
Input:-
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main( )
{
int a,b;
float c;
clrscr( );
printf("Enter length of rectangle:");
scanf("%d",&a);
printf("Enter width of rectangle:");
scanf("%d",&b);
c=sqrt(a*a+b*b);
printf("Daigonal of ractangle=%f",c);
getch( );
}
Output:-
Enter length of rectangle:4
Enter width of rectangle:3
Daigonal of ractangle=5.000000
PROGRAME:-12
Write a programe for calculate simple interest.
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
int p,n;
float r,i;
clrscr( );
printf("Enter Value of p: ");

Visit [Link]
scanf("%d",&p);
printf("Enter Value of n: ");
scanf("%d",&n);
printf("Enter Value of r: ");
scanf("%f",&r);
i=p*r*n/100;
printf("Interest=%5.2f",i);
getch( );
}
Output:-
Enter Value of p: 10000
Enter Value of n: 3
Enter Value of r: 10.00
Interest=3000.00
PROGRAME:-13
Write a programe swap two number without using third variable .
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
int a,b;
clrscr( );
printf("Enter value of a: ");
scanf("%d",&a);
printf("Enter value of b: ");
scanf("%d",&b);
a=b-a;
b=b-a;
a=a+b;
printf("\nValue of a:%d",a);
printf("\nValue of b:%d",b);
getch( );
}
Output:-
Enter value of a: 25
Enter value of b: 36

Value of a:36
Value of b:25

Visit [Link]
PROGRAME:-14
Write a programe swap two number with using third variable .
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
int a,b,c;
clrscr( );
printf("Enter value of a: ");
scanf("%d",&a);
printf("Enter value of b: ");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf("\nValue of a:%d",a);
printf("\nValue of b:%d",b);
getch( );
}
Output:-
Enter value of a: 5
Enter value of b: 9

Value of a:9
Value of b:5

PROGRAME:-15
Write a programe convert temperature celcious into fahrenheit.
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
float c,f;
clrscr( );
printf("Enter temperature in Celcious: ");
scanf("%f",&c);
f=1.8*c+32;
printf("\nTemperature in Fahrenheit=%2.2f",f);

Visit [Link]
getch( );
}
Output:-
Enter temperature in Celcious: 25

Temperature in Fahrenheit=77.00

PROGRAME:-16
Write a programe convert temperature Fahrenheit into calcious.
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
float c,f;
clrscr( );
printf("Enter temperature in Fahrenheit: ");
scanf("%f",&f);
c=(f-32)/1.8;
printf("\nTemperature in Calcious=%2.2f",c);
getch( );
}
Output:-
Enter temperature in Fahrenheit: 98

Temperature in Calcious=36.67

PROGRAME:-17
Write a programe for decide entered no is odd/even.
Input:-
#include<stdio.h>
#include<conio.h>
void main( )
{
int n,a;
clrscr( );
printf("Enter Number:");
scanf("%d",&n);
a=n%2;

Visit [Link]
if(a==0)
{
printf("%d is Even number",n);
}
else
{
printf("%d is Odd number",n);
}
getch( );
}
Output:-
Enter Number:95
95 is Odd number

Visit [Link]

You might also like