October 23rd, 2012 08:56 AM
#1
c code convert to matlab code
I'm trying to understand and learn the matlab language, and since I used to work in c code, I'm interested in knowing how this code would be converted into matlab code..I need your help urgent friends..Need to do this project until tomorrow. my e-mail address alp.eren.1990 @ hotmail.com
enter code here
int main ()
{
int a;
float f;
double g;
a=100;
f=3.14159;
g=3.14592;
printf("a=%d\n",a);
printf("a=%-10d\n",a);
printf("f=%f\n",f);
printf("f=%-10.5f,\n");
}
enter code here
i=1; k=1; m=1;
m+=++i +k++;
printf("%d,%d,%d",i,k,m);
enter code here
sayi=0;
while(sayi!=9)
{
sayi+=3;
printf("%d\n",sayi);
}
enter code here
int main()
{
int a,b,i=0,j,k,f;
printf("Enter a integer\n");
scanf("%d",&a);
printf("\n");
b=2*a-1;
if(a<=0)
printf("Enter the false value!\n);
else
for(j=0;j<a;j++)
{
if(i==0)
{
k=(b-1)/2;
f=(b+1)/2;
}
for(i=0;i<b;i++)
{
if((i<k) '' (i>=f && i<=b))
printf(" ");
else printf("*");
}
k--;
f++;
printf("\n");
}
}
enter code here
int main()
{
int i,j;
for(i=0;i<5;i++)
{
for(j=0;j<i+1;j++)
{
printf("*");
}
printf("\n");
}
enter code here`
int main()
{
int i=0,j;
while(i<5){
j=0;
while(j<i+1){
printf("*");
j++;
}
printf("*");
i++;
}
enter code here
{
int main()
int i,j;
for(i=0;i<5;i++)
{
for(j=0;j<i+1;j--)
{
printf("*");
}
printf("\n");
}
enter code here
int main()
{
int i=0,j;
while(j<i+1)
{
printf("*");
j++;
}
printf("\n");
i++;
return 0;
}
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks