1. Engineering
  2. Computer Science
  3. trying to debug this c program file and not having...

Question: trying to debug this c program file and not having...

Question details

Trying to debug this C program file, and not having any luck really...

/*Debugging quiz - File No: 1 */
/* The program should correctly print the stored variable values*/
/* devise logic inside given forloop to print characters,according to ASCII table, starting from char in alphabet till it is valid */
/* Print the sum of all the odd numbers from 1 to 100 */
/* Sum = 1 + 3 + 5 ... + 97 + 99 */
/* Correct the logical errors in the program */

#include<stdio.h>

int main (void)
{

int limit = 100.3892, sum, counter;
float alphabet = 'A';
printf("The limit is %Lf\n",&limit);
for(counter = 1; counter < limit-1; counter = counter+2)
{
sum += sum+counter;
printf("%f",&alphabet);

}
printf("Sum = %d\n", &counter);

int rev;

for(rev; sum!=0;sum=sum%10)
{
rev = rev * 10;
rev = rev + sum/10;
  
}
printf("Reverse of Sum = %d\n",rev);
}

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution