C programming anwer the following questions The following pr

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 */

Solution

#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++;

}

}

C programming anwer the following questions The following program is supposed to print the word \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site