do
{
Statement ;
increment
}
while(condition);
#include<stdio.h>
#include<conio.h>
void main() {
int temp;
float celsius;
char repeat;
clrscr();
do {
printf("Input a temperature:");
scanf("%d", &temp);
celsius=(5.0/9.0)*(temp-32);
printf("%d degrees F is %6.2f degrees celsius\n",temp, celsius);
printf("do you have another temperature?");
scanf("%s",&repeat);
getchar();
putchar('\n');
}
while(repeat=='y'||repeat=='y');
getch();
}
{
Statement ;
increment
}
while(condition);
example-8
#include<stdio.h>
#include<conio.h>
void main() {
int temp;
float celsius;
char repeat;
clrscr();
do {
printf("Input a temperature:");
scanf("%d", &temp);
celsius=(5.0/9.0)*(temp-32);
printf("%d degrees F is %6.2f degrees celsius\n",temp, celsius);
printf("do you have another temperature?");
scanf("%s",&repeat);
getchar();
putchar('\n');
}
while(repeat=='y'||repeat=='y');
getch();
}
No comments:
Post a Comment