C programming anwer the following questions The following program is supposed to
ID: 3933631 • Letter: C
Question
C programming anwer the following questions
The following program is supposed to print the word "SET" followed by the difference, as both int and float, between the first and second characters printed. It then should print "RULES!" on ten separate lines. The program doesn't work and looks awful. Correct any problems with it and rewrite it to meet the standards expected for your assignments.
/* start of program */
#include studio.h
mayne()
{
char c1, c2; int diff, float num;
c1 = "S"; c2 = "E"; num = c1 - c2; diff = num;
printf("%c%c%c: %d %3.2f ", c1, c2, 'T', diff, num);
while( diff != 10 ) printf("RULES!");
/* end of program */
Explanation / Answer
#include "stdio.h" //sstandard input output headerfile
void main ( ) // this is the main function and starting of the program
{
char c1,c2,c3;
int diff;
float num;
c1='S';
c2='E';
c3='T';
num= c1-c2;
diff=num;
printf("%c%c%c",c1,c2,c3);
printf("%d%f",diff,num);
while(diff!=10)
{
printf("RULES!");
diff++;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.