473,394 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to fix "expected declaration" error at the end of input?

I am trying to do some matrix multiplication but i keep getting a expected declaration at the end of input. Any help would be much appreciated.

Expand|Select|Wrap|Line Numbers
  1. /* Description:To multiply given to matrix using arrays*/
  2.  #include<stdio.h>
  3.  #include<math.h>
  4.  main()
  5.  {
  6.   int i,j,k;
  7.   int a,b,c;/*three variables to get the row and colum of the two matrix*/
  8.   int sum;
  9.   int m[5][5],n[5][5],l[5][5];
  10.  
  11.   printf("The first matrix:\n");
  12.   printf("Enter the number of rows and columns for the first matrix:\t")  ;
  13.   scanf("%d%d",&a,&b);
  14.   printf("The Second matrix:\n");
  15.   printf("Enter the rows and columns of the second matrix:\t");
  16.   scanf("%d%d",&b,&c);
  17.  
  18.   /* Note: For matrix multiplication the number of columns in the first matrix should be equal to the number of rows in the second message*/
  19.  
  20.   printf(":Enter the values of the first matrix:\n");
  21.   for(i=0;i<a;i++)
  22.     {
  23.       for(j=0;j<b;j++)
  24.         {
  25.           scanf("%d",&m[i][j]);
  26.         }
  27.     }
  28.    printf("Enter the values of the second matrix:\n");
  29.    for(i=0;i<b;i++)
  30.     {
  31.       for(j=0;j<c;j++)
  32.        {
  33.          scanf("%d",&n[i][j]);
  34.        }
  35.     }
  36.     for(i=0;i<a;i++)
  37.       {
  38.      for(j=0;j<c;j++)
  39.       {
  40.         sum=0;
  41.         for(k=0;k<b;k++)
  42.          {
  43.            sum=sum+(m[i][k]*n[k][j]);
  44.            l[i][j]=sum;
  45.          }
  46.       }
  47.    }
  48.    printf("The multiplied matrix is:\n");
  49.    for(i=0;i<a;i++)
  50.     {
  51.       for(j=0;j<c;j++)
  52.        {
  53.           printf ("%d",l[i][j]);
  54.           printf("\t");
  55.        }
  56.         printf("\n");
  57.     }
Jan 6 '11 #1
2 7504
horace1
1,510 Expert 1GB
think you have a missing } at the of he file
Jan 6 '11 #2
Thanks that looks like it's solved the compilation issue! Ta
Jan 6 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: bonnie.tangyn | last post by:
Hello all I get Too few parameters expected 2 error and "The MS Jet Database engine cannot find the input table or query "myTempTablename". Make sure it exists and that its name is spelled...
0
by: Jon Paal | last post by:
why is there a declaration error on line 24 ? Compiler Error Message: BC30188: Declaration expected. Source Error: Line 22: Line 23: Dim vResource As New Collection Line 24: ...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
0
by: antique | last post by:
iam supposed to CREATE A FUNCTION INT ADJUSTEDSUM (INT,INT) 1. find the sum of the array of size 100 2. find the number of occurrence of a MIN and MAX number if its twice or more only use 1...
1
by: sachin10 | last post by:
hi i m sachin, i m new to VB programming.i face some problem regarding the sorting of text file contents using arrays.text file have data in the format as below seq...
7
sammyboy78
by: sammyboy78 | last post by:
I was wondering about the format of calling methods using arrays. I know that to call a method when not using arrays it would be formatted in the first class like: public void methodName(...
3
Blackout
by: Blackout | last post by:
Hi, I'm new to C and need to make a program that displays the output of the first six powers of 2 like this: 1 2 4 8 16 32 (2 to the power of 0, 2 to the power of 1, 2 to...
16
by: mike3 | last post by:
(I'm xposting this to both comp.lang.c++ and comp.os.ms- windows.programmer.win32 since there's Windows material in here as well as questions related to standard C++. Not sure how that'd go over...
2
by: theblissfulwizard | last post by:
FYI - New to ASP I'm trying to get multiple values from checkboxes inserted into a table using arrays. I'm using VBscript - ASP 1.1 (not 2.0) and here is what I want to do. I have a page that...
1
by: Raman | last post by:
Hi All, I have two libs (libFirst.a and libSecond.a). Both libs contains a common function func(). Now I want to link an application "app" with these two libs as gcc -o app libFirst.a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.