View Code of Problem 91

#include<stdio.h>
int main()
{
	int a,i,j=0,k,z[100];
  	scanf("%d",&a);
  	for(i=2;i<=a;i++)
        {
        	if(a%i==0) 
                {
                  	z[j++]=i;
                  	a=a/i;
                }
        }
  	j--;
  	printf("%d=",a)
  	for(k=0;k<j-1;k++)
        {
        	printf("%d*",z[k]);
        }
  	printf("%d",z[j-1]);
}
/*
Main.c: In function 'main':
Main.c:16:4: error: expected ';' before 'for'
    for(k=0;k<j-1;k++)
    ^
Main.c:4:16: warning: variable 'z' set but not used [-Wunused-but-set-variable]
  int a,i,j=0,k,z[100];
                ^
Main.c:4:14: warning: unused variable 'k' [-Wunused-variable]
  int a,i,j=0,k,z[100];
              ^
*/

Double click to view unformatted code.


Back to problem 91