criyle/codenet-compile-errors huggingface dataset:
Language: Java

#include <stdio.h>
#include <string.h>

int main(void) {
  char number[1001];
  int sum, i;
  char ch;
  while(1) {
    scanf("%s", number);
    if (strcmp(number, "0") == 0) break;
    i = 0;
    sum = 0;
    while((ch = number[i]) != '\0') {
      sum += number[i] - '0';
      i++;
    }
    printf("%d", sum);
  }
}



Compiler output:
Main.java:1: error: illegal character: '#'
#include <stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <stdio.h>
         ^
Main.java:2: error: illegal character: '#'
#include <string.h>
^
Main.java:6: error: class, interface, enum, or record expected
  int sum, i;
  ^
Main.java:7: error: unnamed classes are a preview feature and are disabled by default.
  char ch;
  ^
  (use --enable-preview to enable unnamed classes)
Main.java:8: error: class, interface, enum, or record expected
  while(1) {
  ^
Main.java:10: error: class, interface, enum, or record expected
    if (strcmp(number, "0") == 0) break;
    ^
Main.java:11: error: class, interface, enum, or record expected
    i = 0;
    ^
Main.java:12: error: class, interface, enum, or record expected
    sum = 0;
    ^
Main.java:13: error: class, interface, enum, or record expected
    while((ch = number[i]) != '\0') {
    ^
Main.java:15: error: class, interface, enum, or record expected
      i++;
      ^
Main.java:16: error: class, interface, enum, or record expected
    }
    ^
Main.java:18: error: class, interface, enum, or record expected
  }
  ^
13 errors
Language: Java

#include <stdio.h>
#include <string.h>

int main(void) {
  char number[1001];
  int sum, i;
  char ch;
  while(1) {
    scanf("%s", number);
    if (strcmp(number, "0") == 0) break;
    i = 0;
    sum = 0;
    while((ch = number[i]) != '\0') {
      sum += number[i] - '0';
      i++;
    }
    printf("%d", sum);
  }
  return 0;
}



Compiler output:
Main.java:1: error: illegal character: '#'
#include <stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <stdio.h>
         ^
Main.java:2: error: illegal character: '#'
#include <string.h>
^
Main.java:6: error: class, interface, enum, or record expected
  int sum, i;
  ^
Main.java:7: error: unnamed classes are a preview feature and are disabled by default.
  char ch;
  ^
  (use --enable-preview to enable unnamed classes)
Main.java:8: error: class, interface, enum, or record expected
  while(1) {
  ^
Main.java:10: error: class, interface, enum, or record expected
    if (strcmp(number, "0") == 0) break;
    ^
Main.java:11: error: class, interface, enum, or record expected
    i = 0;
    ^
Main.java:12: error: class, interface, enum, or record expected
    sum = 0;
    ^
Main.java:13: error: class, interface, enum, or record expected
    while((ch = number[i]) != '\0') {
    ^
Main.java:15: error: class, interface, enum, or record expected
      i++;
      ^
Main.java:16: error: class, interface, enum, or record expected
    }
    ^
Main.java:18: error: class, interface, enum, or record expected
  }
  ^
Main.java:20: error: class, interface, enum, or record expected
}
^
14 errors
Language: Java

#include <stdio.h>
#include <string.h>

int main(void) {
  char number[1001];
  int sum, i;
  char ch;
  while(1) {
    scanf("%s", number);
    if (strcmp(number, "0") == 0) break;
    i = 0;
    sum = 0;
    while((ch = number[i]) != '\0') {
      sum += number[i] - '0';
      i++;
    }
    printf("%d\n", sum);
  }
  return 0;
}



Compiler output:
Main.java:1: error: illegal character: '#'
#include <stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <stdio.h>
         ^
Main.java:2: error: illegal character: '#'
#include <string.h>
^
Main.java:6: error: class, interface, enum, or record expected
  int sum, i;
  ^
Main.java:7: error: unnamed classes are a preview feature and are disabled by default.
  char ch;
  ^
  (use --enable-preview to enable unnamed classes)
Main.java:8: error: class, interface, enum, or record expected
  while(1) {
  ^
Main.java:10: error: class, interface, enum, or record expected
    if (strcmp(number, "0") == 0) break;
    ^
Main.java:11: error: class, interface, enum, or record expected
    i = 0;
    ^
Main.java:12: error: class, interface, enum, or record expected
    sum = 0;
    ^
Main.java:13: error: class, interface, enum, or record expected
    while((ch = number[i]) != '\0') {
    ^
Main.java:15: error: class, interface, enum, or record expected
      i++;
      ^
Main.java:16: error: class, interface, enum, or record expected
    }
    ^
Main.java:18: error: class, interface, enum, or record expected
  }
  ^
Main.java:20: error: class, interface, enum, or record expected
}
^
14 errors
Language: Java

#include <iostream>
#include <string>

using namespace std;

string s;

int main() {
    cout << s << endl;
    while(s != "0"){
        cin >> s;
        int ans = 0;
        for(int i = 0; i < s.size(); i++) {
            ans += s[i] - '0';
        }
        cout << ans <<endl;
    }
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <string>
^
Main.java:6: error: unnamed classes are a preview feature and are disabled by default.
string s;
^
  (use --enable-preview to enable unnamed classes)
Main.java:9: error: not a statement
    cout << s << endl;
              ^
Main.java:11: error: not a statement
        cin >> s;
            ^
Main.java:16: error: not a statement
        cout << ans <<endl;
                    ^
6 errors
Language: Java

import java.util.Scanner;

public class　Main {
	public static void main(String [] args) {
		Scanner scan = new Scanner(System.in);
		int sum;
		String x;
		
		do {
			
			
			x = scan.nextLine();
					
			if(x.equals("0"))break;
			sum = 0;
			
			for(int i = 0; i < x.length(); i++) {
				char c = x.charAt(i);
				sum += (int)c - 48;
			}
			
			System.out.println(sum);
			
		}while(true);
	}
}



Compiler output:
Main.java:3: error: illegal character: '\u3000'
public class?Main {
            ^
1 error
Language: Java

mport java.util.*;
class Main {
    public static void main (String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        while(true) {
            String s = sc.next();
            if(s.equals("0")) break;
            int ret = 0;
            for(int i = 0; i < s.length(); i++) ret += s.charAt(i) - 48;
            System.out.println(ret);
        }
    }
}


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
Language: Java

public class Main{
    public static void main(String args[]){
      Scanner sc=new Scanner(System.in);
       while(true){
        int x=sc.nextInt();
        if(x==0)break;
        boolean can=true;
        int sum=0;
        while(can){
            if(x<10){
                sum+=x;
                System.out.println(sum);
                can=false;
            }
            else{
                sum+=x%10;
            x=(x-x%10)/10;
            }
        }
      }
    }
}


Compiler output:
Main.java:3: error: cannot find symbol
      Scanner sc=new Scanner(System.in);
      ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
      Scanner sc=new Scanner(System.in);
                     ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.io.*;
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
      Scanner sc=new Scanner(System.in);
       while(true){
        String  x=sc.next();
        if(x.equals("0"))break;
        boolean can=true;
        int  sum=0;
        for(int i=0;i<x.length();i++){
               sum+=Integer.parseInt(x[i]);
           }
        System.out.printtln(sum);
      }
    }
}


Compiler output:
Main.java:12: error: array required, but String found
               sum+=Integer.parseInt(x[i]);
                                      ^
Main.java:14: error: cannot find symbol
        System.out.printtln(sum);
                  ^
  symbol:   method printtln(int)
  location: variable out of type PrintStream
2 errors
Language: Java

import java.io.*;
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
      Scanner sc=new Scanner(System.in);
       while(true){
        String  x=sc.next();
        if(x.equals("0"))break;
        int  sum=0;
        for(int i=0;i<x.length();i++){
               sum+=Integer.parseInt(x[i]);
           }
        System.out.printtln(sum);
      }
    }
}


Compiler output:
Main.java:11: error: array required, but String found
               sum+=Integer.parseInt(x[i]);
                                      ^
Main.java:13: error: cannot find symbol
        System.out.printtln(sum);
                  ^
  symbol:   method printtln(int)
  location: variable out of type PrintStream
2 errors
Language: Java

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int inputnum;
        int ans;

        while(true) {
            inputnum = sc.nextInt();
            
            if(inputnum == 0)
                break;
            
            while(inputnum != 0) {
                ans += inputnum % 10;
                inputnum -= inputnum % 10;
                if(inputnum == 0)
                    break;
                inputnum = inputnum / 10;
            }
            
            System.out.println(ans);
        }
    }
}


Compiler output:
Main.java:17: error: variable ans might not have been initialized
                ans += inputnum % 10;
                ^
Main.java:24: error: variable ans might not have been initialized
            System.out.println(ans);
                               ^
2 errors
Language: Java

import java.util.Scanner;

public class Main{
    public static void main(String[]arg){
        Scanner sc = new (System.in);
        while(true){
            String x = sc.next();
            for(int i=0;;i++){
                char c = x.charAt(i);
                int n = c - '0';
                int sum += n;
            }
            System.out.println(sum);
        }
    }
}


Compiler output:
Main.java:5: error: <identifier> expected
        Scanner sc = new (System.in);
                        ^
Main.java:11: error: ';' expected
                int sum += n;
                       ^
Main.java:11: error: not a statement
                int sum += n;
                           ^
3 errors
Language: Java

import java.util.Scanner;

public class Part4 {
    public static void main(String[] args) {
        outer:
        while (true) {
        Scanner sc = new Scanner(System.in);
        String line = sc.next();
        int p = line.length();
        int b=0;

            for (int i = 0; i < p; i++) {
                char a = line.charAt(i);
                if (p == 1 && a == '0') {
                    break outer;
                }
                b = b + (a - 48);
            }
                System.out.println(b);
        }
    }

}


Compiler output:
Main.java:3: error: class Part4 is public, should be declared in a file named Part4.java
public class Part4 {
       ^
1 error
Language: Java

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        while(true){
            String num = sc.next();
            int[] x;
            x = new int[1000];
            int length = num.length();
            int sum=0;

            if(length==0){
                break;
            }else{
                for(int i=0;i<length;i++)
                    x[i] = num.charAt(i) - '0';
            }

            for(int i=0;i<length;i++){
                sum += x[i];
            }

            System.out.println(sum);
        }
    }
}



Compiler output:
Main.java:3: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error
Language: Java

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while(sc.hasNext()) {

            int a = sc.nextInt();
            int sum = 0;

            for (int i=1; ;i++){
                int b = a % 10;
                a = (a-b)/10;
                sum = sum + b;
                if(a==0)
                    break;
            }
            if(sum==0)
                break;

            System.out.printf("%d\n",sum);
        }
    }
}


Compiler output:
Main.java:3: error: class Test1 is public, should be declared in a file named Test1.java
public class Test1 {
       ^
1 error
Language: Java

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while(sc.hasNext()) {

            int a = sc.nextInt();
            int sum = 0;

            for (int i=1; ;i++){
                int b = a % 10;
                a = (a-b)/10;
                sum = sum + b;
                if(a==0)
                    break;
            }
            if(sum==0)
                break;

            System.out.printf("%d\n",sum);
        }
    }
}



Compiler output:
Main.java:3: error: class Test1 is public, should be declared in a file named Test1.java
public class Test1 {
       ^
1 error
Language: Java


import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while(sc.hasNext()) {
            String box = sc.next();
            int sum = 0;
            for(int i=0; i<box.length(); i++){
                sum+=box.charAt(i)-'0';
            }

            System.out.printf("%d\n",sum);
        }
    }
}



Compiler output:
Main.java:4: error: class Test1 is public, should be declared in a file named Test1.java
public class Test1 {
       ^
1 error
Language: Java

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while(sc.hasNext()) {
            String box = sc.next();

            if (box.equals("0"))
                break;

            int sum = 0;
            for(int i=0; i<box.length(); i++){
                sum+=box.charAt(i)-'0';
            }
            System.out.printf("%d\n",sum);
        }
    }
}



Compiler output:
Main.java:3: error: class Test1 is public, should be declared in a file named Test1.java
public class Test1 {
       ^
1 error
Language: Java

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){

			int a=sc.nextInt();
			if(a==0){
				break;
			}
			System.out.println(sumDigits(a));
		}


		}
	public static int sumDigits(int n) {
	    int sum = 0;
        while (n != 0) {
            sum += n % 10;
            n /= 10;
        }
        return sum;
		}


}


Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sum;
        for (String str = sc.next(); !str.equals("0"); str = sc.next()){
            sum = 0;
            char[] ch = str.toCharArray();
            
            for (int i = 0; i < str.length(); i++){
                sum += ch[i] - '0';
            }
            System.out.println(sum);
        }
    }
}


Compiler output:
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

#include <stdio.h>
int main(void){
  int num,a;
  while(1){
      scanf("%d", &num);
      if(num==0)
      break;
      else{
      int sum = 0;
      while(num>0){
          a = num % 10;
          sum = sum + a;
          num = num / 10;
      }
       printf("%d\n", sum);

  }}
  return 0;

}


Compiler output:
Main.java:1: error: illegal character: '#'
#include <stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <stdio.h>
         ^
Main.java:4: error: class, interface, enum, or record expected
  while(1){
  ^
Main.java:6: error: class, interface, enum, or record expected
      if(num==0)
      ^
Main.java:8: error: class, interface, enum, or record expected
      else{
      ^
Main.java:10: error: class, interface, enum, or record expected
      while(num>0){
      ^
Main.java:12: error: class, interface, enum, or record expected
          sum = sum + a;
          ^
Main.java:13: error: class, interface, enum, or record expected
          num = num / 10;
          ^
Main.java:14: error: class, interface, enum, or record expected
      }
      ^
Main.java:17: error: class, interface, enum, or record expected
  }}
  ^
Main.java:20: error: class, interface, enum, or record expected
}
^
11 errors
Language: Java

import java.util.Scanner;
class Main{
 public static void main(String[] args){
  String s;
  int i,g;
  Scanner sc = new Scanner(System.in);
  while(true){
   s=sc.next()
   if(s.equals("0"))break;
   g=0;
   for(i=0;i<s.length();i++)
    g+=s.charAt(i)-48;
   System.out.println(g);
  }
 }
}


Compiler output:
Main.java:8: error: ';' expected
   s=sc.next()
              ^
1 error
Language: Java

import java.util.Scanner;
public class SumOfNumbers {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int x,ans;
		while(true){
			x=scan.nextInt();
			ans=0;
			if(x==0) break;
			ans+=(x/1000);
			x=x-((x/1000)*1000);
			ans+=(x/100);
			x=x-((x/100)*100);
			ans+=(x/10);
			x=x-((x/10)*10);
			ans+=x;
			System.out.println(ans);
		}
		scan.close();
	}
}

Compiler output:
Main.java:2: error: class SumOfNumbers is public, should be declared in a file named SumOfNumbers.java
public class SumOfNumbers {
       ^
1 error
Language: Java

package charactor;

import java.util.Scanner;

public class Sum_of_Numbers {

	public static void main(String[] args) {

		int sum = 0;
		StringBuilder out = new StringBuilder();
		
		// 標準入力
		Scanner sc = new Scanner(System.in);
		
		while (sc.hasNext()) {
			String words = sc.next();
			
			if(words.equals("0"))
			break;
			
			char ch[] = words.toCharArray();

			//
			sum = 0;
			for (int i = 0; i < ch.length; i++) {
				//
				String str = String.valueOf(ch[i]);
				int num = Integer.parseInt(str);
				sum += num;
			}
			out = new StringBuilder(out+(sum+"\n"));
		}

		// 結果出力
		System.out.print(out);

	}

}

Compiler output:
Main.java:5: error: class Sum_of_Numbers is public, should be declared in a file named Sum_of_Numbers.java
public class Sum_of_Numbers {
       ^
1 error
Language: Java

import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String x;
		int total;
		while(true){
			x = sc.next();
			if (x.equals("0")){
				break;
			}
			total = 0;
			for (int i = 0; i < x.length(); i++){
				total += Integer.parseInt(x.charAt(i));
			}
			System.out.println(total);
		}
	}
}

Compiler output:
Main.java:14: error: incompatible types: char cannot be converted to String
				total += Integer.parseInt(x.charAt(i));
				                                  ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: Java

package charactor;

import java.util.Scanner;

public class Sum_of_Numbers {

	public static void main(String[] args) {

		int sum = 0;
		StringBuilder out = new StringBuilder();

		// 標準入力
		Scanner sc = new Scanner(System.in);

		while (sc.hasNext()) {
			String words = sc.next();

			if (words.equals("0"))
				break;

			char ch[] = words.toCharArray();

			//
			sum = 0;
			for (int i = 0; i < ch.length; i++) {
				//
				String str = String.valueOf(ch[i]);
				int num = Integer.parseInt(str);
				sum += num;
			}
			out = new StringBuilder(out + (sum + "\n"));
		}

		// 結果出力
		System.out.print(out);

	}

}

Compiler output:
Main.java:5: error: class Sum_of_Numbers is public, should be declared in a file named Sum_of_Numbers.java
public class Sum_of_Numbers {
       ^
1 error
Language: C


#include <stdio.h>
int main(){
	int i,sum;
	char c[1000];
	while (1){
		gets(c);
		if (c[0]=='0') break;
		sum=0;
		for (i=0; c[i]>='0'&&c[i]<='9'; i++)
			sum += c[i]-'0';
		printf("%d\n", sum);
	}
	return 0;
}

 

 



Compiler output:
main.c: In function 'main':
main.c:7:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    7 |                 gets(c);
      |                 ^~~~
      |                 fgets
Language: C


#include <stdio.h>
int main(){
	int i,sum;
	char c[1001];
	while (1){
		gets(c);
		if (c[0]=='0') break;
		sum=0;
		for (i=0; c[i]>='0'&&c[i]<='9'; i++)
			sum += c[i]-'0';
		printf("%d\n", sum);
	}
	return 0;
}

 

 



Compiler output:
main.c: In function 'main':
main.c:7:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    7 |                 gets(c);
      |                 ^~~~
      |                 fgets
Language: C


#include <stdio.h>
int main(){
	int i,sum;
	char c[1001];
	while (1){
		gets(c);
		if (c[0]=='0') break;
		sum=0;
		for (i=0; c[i]>='0'&&c[i]<='9'; i++)
			sum += c[i]-'0';
		printf("%d\n", sum);
	}
	return 0;
}



Compiler output:
main.c: In function 'main':
main.c:7:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    7 |                 gets(c);
      |                 ^~~~
      |                 fgets
Language: C

#include<stdio.h>

int main()
{
int sum,i;
char x[1001];


for(;;){
        scanf("%s",x);
        if(x[0]==0)break;

        sum=0;
        for(i=0;;i++){
                      if(char[i]!='\0') sum+=char[i]-'0';
                      }
        printf("%d\n",sum);
        }
 return 0;

}



Compiler output:
main.c: In function 'main':
main.c:15:26: error: expected expression before 'char'
   15 |                       if(char[i]!='\0') sum+=char[i]-'0';
      |                          ^~~~
main.c:15:46: error: expected expression before 'char'
   15 |                       if(char[i]!='\0') sum+=char[i]-'0';
      |                                              ^~~~
Language: C

#include<stdio.h>

int main()
{
int sum,i;
char x[1001];


for(;;){
        scanf("%s",x);
        if(x[0]==0)break;

        sum=0;
        for(i=0;char[i]!='\0';i++)
                      sum+=char[i]-'0';
                      printf("%d\n",sum);
        }
 return 0;

}



Compiler output:
main.c: In function 'main':
main.c:14:17: error: expected expression before 'char'
   14 |         for(i=0;char[i]!='\0';i++)
      |                 ^~~~
main.c:15:28: error: expected expression before 'char'
   15 |                       sum+=char[i]-'0';
      |                            ^~~~
Language: C

#include<stdio.h>

int main()
{
int sum,i;
char x[1001];


for(;;){
        scanf("%s",x);
        if(x[0]=='0')break;

        sum=0;
        for(i=0;x[i]!='\0';i++)
                      sum+=x[i]-'0';
                      printf("%d\n",sum);
        }
 return 0;

}
 
    scanf("%s", &num);
    if(num[0] == '0') break;
     
    sum = 0;
    for(i=0;num[i]!='\0';i++)
      sum += num[i] - '0';
    printf("%d\n", sum);
  }
   



Compiler output:
main.c:22:11: error: expected declaration specifiers or '...' before string constant
   22 |     scanf("%s", &num);
      |           ^~~~
main.c:22:17: error: expected declaration specifiers or '...' before '&' token
   22 |     scanf("%s", &num);
      |                 ^
main.c:23:5: error: expected identifier or '(' before 'if'
   23 |     if(num[0] == '0') break;
      |     ^~
main.c:25:5: warning: data definition has no type or storage class
   25 |     sum = 0;
      |     ^~~
main.c:25:5: error: type defaults to 'int' in declaration of 'sum' [-Wimplicit-int]
main.c:26:5: error: expected identifier or '(' before 'for'
   26 |     for(i=0;num[i]!='\0';i++)
      |     ^~~
main.c:26:17: error: 'i' undeclared here (not in a function)
   26 |     for(i=0;num[i]!='\0';i++)
      |                 ^
main.c:26:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '!=' token
   26 |     for(i=0;num[i]!='\0';i++)
      |                   ^~
main.c:26:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   26 |     for(i=0;num[i]!='\0';i++)
      |                           ^~
main.c:28:12: error: expected declaration specifiers or '...' before string constant
   28 |     printf("%d\n", sum);
      |            ^~~~~~
main.c:28:20: error: expected declaration specifiers or '...' before 'sum'
   28 |     printf("%d\n", sum);
      |                    ^~~
main.c:29:3: error: expected identifier or '(' before '}' token
   29 |   }
      |   ^
Language: C

#include<stdio.h>

int main()
{
int sum,i;
char x[1001];


for(;;){
        scanf("%s",&x);
        if(x[0]=='0')break;

        sum=0;
        for(i=0;x[i]!='\0';i++)
                      sum+=x[i]-'0';
                      printf("%d\n",sum);
        }
 return 0;

}
 
    scanf("%s", &num);
    if(num[0] == '0') break;
     
    sum = 0;
    for(i=0;num[i]!='\0';i++)
      sum += num[i] - '0';
    printf("%d\n", sum);
  }
   



Compiler output:
main.c:22:11: error: expected declaration specifiers or '...' before string constant
   22 |     scanf("%s", &num);
      |           ^~~~
main.c:22:17: error: expected declaration specifiers or '...' before '&' token
   22 |     scanf("%s", &num);
      |                 ^
main.c:23:5: error: expected identifier or '(' before 'if'
   23 |     if(num[0] == '0') break;
      |     ^~
main.c:25:5: warning: data definition has no type or storage class
   25 |     sum = 0;
      |     ^~~
main.c:25:5: error: type defaults to 'int' in declaration of 'sum' [-Wimplicit-int]
main.c:26:5: error: expected identifier or '(' before 'for'
   26 |     for(i=0;num[i]!='\0';i++)
      |     ^~~
main.c:26:17: error: 'i' undeclared here (not in a function)
   26 |     for(i=0;num[i]!='\0';i++)
      |                 ^
main.c:26:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '!=' token
   26 |     for(i=0;num[i]!='\0';i++)
      |                   ^~
main.c:26:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   26 |     for(i=0;num[i]!='\0';i++)
      |                           ^~
main.c:28:12: error: expected declaration specifiers or '...' before string constant
   28 |     printf("%d\n", sum);
      |            ^~~~~~
main.c:28:20: error: expected declaration specifiers or '...' before 'sum'
   28 |     printf("%d\n", sum);
      |                    ^~~
main.c:29:3: error: expected identifier or '(' before '}' token
   29 |   }
      |   ^
Language: C

nclude<stdio.h>

int main(void){
    char x[1003];
    int sum,i;

    while(1){
        scanf("%s",x);
        if(x[0] ==  '0' && x[1] == '\0')
            break;
        sum = 0;i = 0;
        while(x[i] != '\0')
            sum += x[i++] - '0';
        printf("%d\n",sum);
    }
    return 0;
}





Compiler output:
main.c:1:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | nclude<stdio.h>
      |       ^
Language: C

#include <stdio.h>

int main() {
    int sum,x;
    while(scanf("%d",&x)==1&&x!=0)
    {
        smu = 0;
        while(x > 0)
        {
            sum = x % 10;
            x /= 10;
        }
        printf("%d",sum);
    }
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:9: error: 'smu' undeclared (first use in this function); did you mean 'sum'?
    7 |         smu = 0;
      |         ^~~
      |         sum
main.c:7:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>

int main() {
    int sum,x;
    while(scanf("%d",&x)==1&&x!=0)
    {
        sum = 0;
        while(x > 0)
        {
            sum + = x % 10;
            x /= 10;
        }
        printf("%d",sum);
    }
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:10:19: error: expected expression before '=' token
   10 |             sum + = x % 10;
      |                   ^
Language: C

#include <stdio.h>
int main(){
	int i,sum;
	char c[1001];
	while (1){
		gets(c);
		if (c[0]=='0') break;
		sum=0;
		for (i=0; c[i]>='0'&&c[i]<='9'; i++)
			sum += c[i]-'0';
		printf("%d\n", sum);
	}
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:6:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    6 |                 gets(c);
      |                 ^~~~
      |                 fgets
Language: C

#include<stdio.h>

int main(void) {

    char s[1000];   // 入力

    int sum;        // 出力

    while (1) {

        scanf("%s", s);

        if (s[0] == '0') {
            break;
        }

        for (int i = 0; i < sizeof(s); i++) {
            sum += atoi(&s[i]);
        }

        cout << sum << endl;

    }

    return 0;
} 


Compiler output:
main.c: In function 'main':
main.c:18:20: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
   18 |             sum += atoi(&s[i]);
      |                    ^~~~
main.c:21:9: error: 'cout' undeclared (first use in this function)
   21 |         cout << sum << endl;
      |         ^~~~
main.c:21:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:21:24: error: 'endl' undeclared (first use in this function)
   21 |         cout << sum << endl;
      |                        ^~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<cmath>

int main(void) {

    char s[1000];   // 入力

    int num;
    int X;

    int sum;        // 出力

    while (1) {

        sum = 0;

        scanf("%s", s);

        if (s[0] == '0') {
            break;
        }

        num = atoi(s);

        for (int i = log10(num); i >= 0; i--) {
            X = num / pow(10, i);
            sum += X;
            
            num -= X * pow(10, i);
        }

        printf("%d\n", sum);

    }

    return 0;
} 


Compiler output:
main.c:3:9: fatal error: cmath: No such file or directory
    3 | #include<cmath>
      |         ^~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
int main(void){

int x,y=0;
int number[4];

while(;;){
	scanf("%d", number);

	if(x==0){
	break;
	}
	for(i=0;number[i]!='\0';i++){
	y+=number[i];
	}
	printf("%d", y);
 	printf("\n");
}

return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:7: error: expected expression before ';' token
    7 | while(;;){
      |       ^
main.c:13:13: error: 'i' undeclared (first use in this function)
   13 |         for(i=0;number[i]!='\0';i++){
      |             ^
main.c:13:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>



int main(){



  char a[100][1000];



  int i=0;



  while(1){



    fgets(a[i],1200,stdin);

 

    if(a[i][0]=='0'&&a[i][1]=='\n')



      break;



    i++;



  }



  int s,t;



  int b[i];



  for(s=0;s<=i;s++){



    b[s]=0;



    for(t=0;a[s][t]!='\n';t++){



      b[s]+=a[s][t]-'0';



    }



  }

Compiler output:
main.c: In function 'main':
main.c:69:3: error: expected declaration or statement at end of input
   69 |   }
      |   ^
Language: C

#include<stdio.h>
#define MAX 1000
int main(){
	int i,j,c[MAX]={},sum=0;
	while(gets(c)!='0'){
		for(i=0; i<MAX; i++){
			sum += int(c[i]);
		}
		printf("%d\n", sum);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:15: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    5 |         while(gets(c)!='0'){
      |               ^~~~
      |               fgets
main.c:7:32: error: expected expression before 'int'
    7 |                         sum += int(c[i]);
      |                                ^~~
Language: C

#include<stdio.h>
#define MAX 1000
int main(){
	int i=0,j,c[MAX]={},sum=0;
	while(gets(c)!='0'){
		while(c[i]!='\0'){}
			sum += c[i];
			i++;
		}
		printf("%d\n", sum);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:15: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    5 |         while(gets(c)!='0'){
      |               ^~~~
      |               fgets
main.c: At top level:
main.c:12:9: error: expected identifier or '(' before 'return'
   12 |         return 0;
      |         ^~~~~~
main.c:13:1: error: expected identifier or '(' before '}' token
   13 | }
      | ^
Language: C

#include<stdio.h>
#define MAX 1000
int main(){
	int i=0,j,n,sum;
		while(1)
			scanf("%d", n);
			while(n!=0){break;}
			sum += n%10;
			n = n/10;
		}
		printf("%d\n", sum);
	}
	printf("\n");
	return 0;
}

Compiler output:
main.c:11:24: error: expected declaration specifiers or '...' before string constant
   11 |                 printf("%d\n", sum);
      |                        ^~~~~~
main.c:11:32: error: unknown type name 'sum'
   11 |                 printf("%d\n", sum);
      |                                ^~~
main.c:12:9: error: expected identifier or '(' before '}' token
   12 |         }
      |         ^
main.c:13:16: error: expected declaration specifiers or '...' before string constant
   13 |         printf("\n");
      |                ^~~~
main.c:14:9: error: expected identifier or '(' before 'return'
   14 |         return 0;
      |         ^~~~~~
main.c:15:1: error: expected identifier or '(' before '}' token
   15 | }
      | ^
Language: C

#include<stdio.h>
#define MAX 1000
int main(){
	int i=0,j,n,sum;
		while(1)
			scanf("%d", &n);
			while(n!=0){
				sum += n%10;
				n = n/10;
			}
		}
		printf("%d\n", sum);
	}
	printf("\n");
	return 0;
}

Compiler output:
main.c:12:24: error: expected declaration specifiers or '...' before string constant
   12 |                 printf("%d\n", sum);
      |                        ^~~~~~
main.c:12:32: error: unknown type name 'sum'
   12 |                 printf("%d\n", sum);
      |                                ^~~
main.c:13:9: error: expected identifier or '(' before '}' token
   13 |         }
      |         ^
main.c:14:16: error: expected declaration specifiers or '...' before string constant
   14 |         printf("\n");
      |                ^~~~
main.c:15:9: error: expected identifier or '(' before 'return'
   15 |         return 0;
      |         ^~~~~~
main.c:16:1: error: expected identifier or '(' before '}' token
   16 | }
      | ^
Language: C

#include<stdio.h>
#define MAX 1000
int main(){
	int i=0,j,n,sum;
		while(1){}
			scanf("%d", &n);
			while(n!=0){
				sum += n%10;
				n = n/10;
			}
			printf("%d\n", sum);
		}
	printf("\n");
	return 0;
}

Compiler output:
main.c:13:16: error: expected declaration specifiers or '...' before string constant
   13 |         printf("\n");
      |                ^~~~
main.c:14:9: error: expected identifier or '(' before 'return'
   14 |         return 0;
      |         ^~~~~~
main.c:15:1: error: expected identifier or '(' before '}' token
   15 | }
      | ^
Language: C

#include<stdio.h>
#define MAX 1000
int main(){
	int i=0,j,n,
	long long sum;
		while(1){
			sum=0;
			scanf("%d", &n);
			if(n==0){break;}
			else{
				while(n!=0){
					sum += n%10;
					n = n/10;
				}
			}
			printf("%lld\n", sum);
		}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:9: error: expected identifier or '(' before 'long'
    5 |         long long sum;
      |         ^~~~
main.c:7:25: error: 'sum' undeclared (first use in this function)
    7 |                         sum=0;
      |                         ^~~
main.c:7:25: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>

int main(){
int n,a,b,c;

while(1){
scanf("%d\n",&n);

if(n==0)break;
if(n==1000){
printf(1"\n");
}else {
a=n/100;
b=(n-100*a)/10;
c=n-(100*a+10*b);
printf("%d\n",a+b+c);
}
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:9: error: expected ')' before string constant
   11 | printf(1"\n");
      |       ~ ^~~~
      |         )
main.c:11:8: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
   11 | printf(1"\n");
      |        ^
      |        |
      |        int
In file included from main.c:1:
/usr/include/stdio.h:363:43: note: expected 'const char * restrict' but argument is of type 'int'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C

#include <stdio.h>

int main(void){

  char num[];
  int count = 0;
  register int i;
  int sum;

  while(1){
    scanf("%s",&num);
    if(num == '0'){
      printf("\n");
      break;
    }
    for(i = 0;i < sizeof num;i++){
      sum += (int)num[i];
    }
    printf("%d\n",sum);
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:8: error: array size missing in 'num'
    5 |   char num[];
      |        ^~~
main.c:12:12: warning: comparison between pointer and integer
   12 |     if(num == '0'){
      |            ^~
Language: C

#include<stdio.h>
int main(){
int c=0,d=0,a=0,num,x,n,m,z,x,f,s;
while(1){
x=getchar();
if(x=='0')
break;
else
num=x-'0';
while(1){
	n=getchar();
	if(n=='\n'){
		printf("%d",num);
		num=0;
		break;
	}
	num+=n-'0';
}
}

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:3:29: error: redeclaration of 'x' with no linkage
    3 | int c=0,d=0,a=0,num,x,n,m,z,x,f,s;
      |                             ^
main.c:3:21: note: previous declaration of 'x' with type 'int'
    3 | int c=0,d=0,a=0,num,x,n,m,z,x,f,s;
      |                     ^
Language: C

#include<stdio.h>
int main(){
int c=0,d=0,a=0,num,x,n,m,z,x,f,s;
while(1){
x=getchar();
if(x=='0')
break;
else
num=x-'0';
while(1){
	n=getchar();
	if(n=='\n'){
		printf("%d\n",num);
		num=0;
		break;
	}
	num+=n-'0';
}
}

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:3:29: error: redeclaration of 'x' with no linkage
    3 | int c=0,d=0,a=0,num,x,n,m,z,x,f,s;
      |                             ^
main.c:3:21: note: previous declaration of 'x' with type 'int'
    3 | int c=0,d=0,a=0,num,x,n,m,z,x,f,s;
      |                     ^
Language: C

#include <stdio.h>

int main(void){
	char num[1001];
	long int sum;

	while (true){
		scanf_s("%s", num, 1001);

		if (num[0] == '0') break;

		sum = 0;
		for (int i = 0; i < 1001; i++){
			if (num[i] == '\0') break;

			sum += num[i] - '0';
		}

		printf("%d\n", sum);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:16: error: 'true' undeclared (first use in this function)
    7 |         while (true){
      |                ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:7:16: note: each undeclared identifier is reported only once for each function it appears in
    7 |         while (true){
      |                ^~~~
main.c:8:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    8 |                 scanf_s("%s", num, 1001);
      |                 ^~~~~~~
      |                 scanf
Language: C

#include <stdio.h>

int main(void){
	char num[1001];
	long int sum;

	while (true){
		scanf("%s", num);

		if (num[0] == '0') break;

		sum = 0;
		for (int i = 0; i < 1001; i++){
			if (num[i] == '\0') break;

			sum += num[i] - '0';
		}

		printf("%d\n", sum);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:16: error: 'true' undeclared (first use in this function)
    7 |         while (true){
      |                ^~~~
main.c:2:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:7:16: note: each undeclared identifier is reported only once for each function it appears in
    7 |         while (true){
      |                ^~~~
Language: C

#include <cstdio>
int main(){
	int sum;
	unsigned long long int i;
	while(1){
		sum = 0;
		scanf("%lld",&i);
		if(!i)break;
		while(i){
			sum += i%10;
			i /= 10;
		}
		printf("%d\n",sum);
	}
}

Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>

int main(){
	char s[1001];
	int ans=0,i=0;
	while(1){
		i=0;
ans =0;
		if(scanf("%c",&s[0])=='0') break;
	while((scanf("%c",&s[i++])!='\0'){
			ans += s[i]-'0';
		}
		printf("%d",ans);
	}
	return 0;
}
		

Compiler output:
main.c: In function 'main':
main.c:10:42: error: expected ')' before '{' token
   10 |         while((scanf("%c",&s[i++])!='\0'){
      |              ~                           ^
      |                                          )
main.c:14:9: error: expected expression before '}' token
   14 |         }
      |         ^
Language: C

#include<stdio.h>

int main(){
	char s[1001];
	int ans=0,i=0,ch;
	while(1){
		i=0;
		scanf("%s",s);
		
		if(s[0]=='0') break;
	while(s[i]!='\0'){
			ans += s[i]-'0';
			i++
		}
		printf("%d",ans);
	}
	return 0;
}
		

Compiler output:
main.c: In function 'main':
main.c:13:28: error: expected ';' before '}' token
   13 |                         i++
      |                            ^
      |                            ;
   14 |                 }
      |                 ~
Language: C

include<stdio.h>
 
int main(void)
{
	char num[1000];
    int count,tmp,sum;
    while(1){
		scanf("%s", num);
		if(num[0]==48) break;
		count=0;
		sum=0;
		while(1){
			if(num[count]=='\0') break;
			tmp=(int)num[count++]-48;
			sum+=(tmp%10)+(tmp/10);
		}
		printf("%d\n",sum);
	}
    return 0;   
}   

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
Language: C

#include<stdio.h>
int main(void){
int r,t=0;
double i;
while(1){
scanf("%f",&i);
if(i==0){break;}else{
for(r=0;r<1000;r++){
t+=i%10;
i/=10;
}
printf("%d\n",t);
t=0;
}
}
return 0;
} 

Compiler output:
main.c: In function 'main':
main.c:9:5: error: invalid operands to binary % (have 'double' and 'int')
    9 | t+=i%10;
      |     ^
Language: C

#include<stdio.h>
int main(void){
int r,t=0;
double i;
while(1){
scanf("%f",&i);
if(i==0.0){break;}else{
for(r=0;r<1000;r++){
t+=i%10;
i=(i-i%10)/10;
}
printf("%d\n",t);
t=0;
}
}
return 0;
} 

Compiler output:
main.c: In function 'main':
main.c:9:5: error: invalid operands to binary % (have 'double' and 'int')
    9 | t+=i%10;
      |     ^
main.c:10:7: error: invalid operands to binary % (have 'double' and 'int')
   10 | i=(i-i%10)/10;
      |       ^
Language: C

#include<stdio.h>
int main(void){
char c;
int f=0,sum=0;
while(1){
scanf("%c",&c);
if(f==1&&c=='0')braek;
if(c=='\n'){
f=1;
printf("%d",sum);
sum=0;
printf("\n");
}else{
f=0;
sum+=c-'0';
}
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:17: error: 'braek' undeclared (first use in this function)
    7 | if(f==1&&c=='0')braek;
      |                 ^~~~~
main.c:7:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main(){
int x,i,sum=0;
char ch[1001];
scanf("%d\n",&x);
while(1){
scanf("%s\n",&ch);
if(ch[0]=='0')break;
while(i=0;i<x;i++){
if(ch[i]=='1')sum+=1;else if(ch[i]=='2')sum+=2;else if(ch[i]=='3')sum+=3;else if(ch[i]=='4')sum+=4;else if(ch[i]=='5')sum+=5;else if(ch[i]=='6')sum+=6;else if(ch[i]=='7')sum+=7;else if(ch[i]=='8')sum+=8;else if(ch[i]=='9')sum+=9;
}
printf("%d\n",sum);
sum=0;
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:10: error: expected ')' before ';' token
    9 | while(i=0;i<x;i++){
      |      ~   ^
      |          )
Language: C

#include<stdio.h>
int main(){
int x,i,sum=0;
char ch[1001];
scanf("%d\n",&x);
while(1){
scanf("%s\n",&ch);
if(ch[0]=='0')break;
while(i=0;i<x;i++){
if(ch[i]=='1')sum+=1;
else if(ch[i]=='2')sum+=2;
else if(ch[i]=='3')sum+=3;
else if(ch[i]=='4')sum+=4;
else if(ch[i]=='5')sum+=5;
else if(ch[i]=='6')sum+=6;
else if(ch[i]=='7')sum+=7;
else if(ch[i]=='8')sum+=8;
else if(ch[i]=='9')sum+=9;
}
printf("%d\n",sum);
sum=0;
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:10: error: expected ')' before ';' token
    9 | while(i=0;i<x;i++){
      |      ~   ^
      |          )
Language: C

#include <stdio.h>

int main(void){
    int work = 0;
    int sum = 0;

    do{
        scanf("%d",&work);
        if(work == 0){
            break;
        }
        while(work != 0){
            sum = work % 10;
            work /= 10;
        }
        printf("%d\n",sum);
        work = sum = 0;
    }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:5: error: expected 'while' before 'return'
   19 |     return 0;
      |     ^~~~~~
Language: C

#include<stdio.h>
int main(void){
	
	char x[1001];
	int sum=0;
	int i;
	
	while(1){
		scanf("%s",x);
		if(x[0]=='0'){
			break;
		}
		for(i=0;i<=1000;i++){
			sum+=x[i];
		}
		printf("%d\n",sum);
		x=0;
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:18: error: assignment to expression with array type
   17 |                 x=0;
      |                  ^
Language: C

#include<stdio.h>
int main(void){
	
	char x[1001];
	int sum=0;
	int i;
	
	while(1){
		scanf("%s",x);
		if(x[0]=='0'){
			break;
		}
		for(i=0;i<=1000;i++){
			sum+=x[i];
		}
		printf("%d\n",sum);
		
		x='0';
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:18:18: error: assignment to expression with array type
   18 |                 x='0';
      |                  ^
Language: C

#include<stdio.h>
int main(void){
	
	char x[1001];
	int sum=0;
	int i,j;
	
	while(1){
		scanf("%s",x);
		if(x[0]=='0'){
			break;
		}
		for(i=0;i<=1000;i++){
			j=x[i]-'0';
			sum+=j;
			j=0;
		}
		printf("%d\n",sum);
		x='0';
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:18: error: assignment to expression with array type
   19 |                 x='0';
      |                  ^
Language: C

#include<stdio.h>
int main(void){
	
	char x[1001]='0';
	int sum=0;
	int i,j;
	
	while(1){
		scanf("%s",x);
		if(x[0]=='0'){
			break;
		}
		for(i=0;i<=1000;i++){
			j=x[i]-'0';
			sum=sum+j;
			j=0;
			x[i]='0';
		}
		printf("%d\n",sum);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:22: error: invalid initializer
    4 |         char x[1001]='0';
      |                      ^~~
Language: C

#include<stdio.h>
int main(void)
{
	int num;
	int ten_mul = 1;
	int tmp;
	int sum = 0;
	int i=0,j;

	scanf_s("%d",&num);

	while(1)
	{
		i++;

		for (j = 0; j<1; j++)
		{
			ten_mul = ten_mul*10;
		}

		tmp = (num % ten_mul) / (ten_mul / 10);

		sum += tmp;


		printf("%d\n", tmp);

		tmp = 0;

		if (ten_mul>num || i >= 1000) break;

	}

	printf("%d",sum);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   10 |         scanf_s("%d",&num);
      |         ^~~~~~~
      |         scanf
Language: C

#include<stdio.h>
int main(void)
{
	int num;
	int ten_mul = 1;
	int tmp;
	int sum = 0;
	int i=0;

	while (1)
	{
		scanf_s("%d", &num);

		if (num == 0) break;

		while (1)
		{
			i++;

			ten_mul = ten_mul * 10;

			tmp = (num % ten_mul) / (ten_mul / 10);

			sum += tmp;


			printf("%d\n", tmp);

			tmp = 0;

			if (ten_mul>num || i >= 1000) break;

		}

		printf("%d\n", sum);

		ten_mul = 1;
		i = 0;
		sum = 0;
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   12 |                 scanf_s("%d", &num);
      |                 ^~~~~~~
      |                 scanf