0% found this document useful (0 votes)
29 views2 pages

New Text Document

The document contains code for a menu-driven C program with options for mathematical operations, string manipulation, one-dimensional arrays, and two-dimensional arrays. The program uses scanf and printf functions to take user input and display output.

Uploaded by

Marina Moraru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

New Text Document

The document contains code for a menu-driven C program with options for mathematical operations, string manipulation, one-dimensional arrays, and two-dimensional arrays. The program uses scanf and printf functions to take user input and display output.

Uploaded by

Marina Moraru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

# include <stdio.

h>
# include <stdlib.h>
# include <math.h>
# include <string.h>
main()
{int op;
int nv;
char s[100];
float o,p;
char l;
printf ("Doriti sa incepeti acest prorg? 'd/n ");
scanf ("%c",&l);
if (l=='d'){
system("cls");
printf ("\tMeniu\n");
printf ("1.Matematic\n");
printf ("2.Siruri de caractere\n");
printf ("3.Tabel bidimensional\n");
printf ("4.Tabel unidimensional\n");
printf("Introuceti optiunea de meniu\n");
scanf ("%d",&op);
system ("cls");
switch (op)
{case 1: {
printf("Intoduceti nr.") ;
scanf ("%f",&p);
o= sqrt(p);
printf ("radicalul de ord 2 al nr. %.2f este = %.2f",p,o);}break;
case 2:{
nv=0;
printf("Introduceti sirl de caractere:\n");
scanf("%c",&s);
for int j=1;j++;j<strlen(s)
if ((s[j]=='a')||)
printf ("Nr de vocale : %d",nv);
}
break;
case 3:
{int n;
printf("Introduceti numarul de elemente ");
scanf("%d",&n);
int t[n];
for (int i=1;i<=n;i++)
{printf ("t[%d]=",i);
scanf("%d",&t[i]);
}
for (int i=1;i<=n;i++){
printf("%d ",t[i]);
printf(" \n");
}
}break;
case 4:
{int n,m;
printf("Introduceti numarul de rinduri ");
scanf("%d",&n);
printf("Introduceti numarul de coloane ");
scanf("%d",&m);
int t[n][m];
for (int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
{printf ("t[%d][%d]=",i,j);
scanf("%d",&t[i][j]);
}
for (int i=1;i<=n;i++)
{for(int j=1;j<=m;j++)
printf("%d ",t[i][j]);
printf(" \n");
}
}break;
}
}
}

You might also like